Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision bd34eaea

Von Udo Spallek vor mehr als 17 Jahren hinzugefügt

  • ID bd34eaeac9e09277148172dc634c0cd71bff91a8
  • Vorgänger 2fda509c
  • Nachfolger 770515d9

System->Konteneinstellungen ueberarbeitet:

  • Alles auf das Templatesystem umgestellt
  • Kontenliste
    - Klick auf Beschreibung zeigt Details an
    (Ajax template list_account_details)
    - Klick auf Kontonummer öffnet Einstellungen (wie gehabt)
    - Ueberschriften werden per css (accountlistheader) formatiert
    - Gegenueberstellung von allen Konten mit allen Details
    - Uebersetzungn
  • Konteneinstellungen
    - Steuerautomatik und USTVA Positionen sind einstellbar/loeschbar
    (max. 10 Steuerkonten)
    - Folgekonto: Sortierung nach chart.accno
    - Validierung:
    + Wenn Kontentyp Ueberschrift, alle anderen Einstellungen entfernen
    (js/FormManager.js)
    + Must have: Kontonummer, Beschreibung, Kontentyp, (Kontenart)
    + Taxkeys: Gueltig, wenn Startdate und mindestens ein Merkmal aus:
    Steuerverknuepfung oder USTVA Position
    - Beim loeschen eines Kontos werden alle abhaengigen taxkeys geloescht
    - Uebersetzungen

Unterschiede anzeigen:

SL/AM.pm
47 47

  
48 48
  # connect to database
49 49
  my $dbh = $form->dbconnect($myconfig);
50
  my $query =
51
    qq!SELECT c.accno, c.description, c.charttype, c.category,! .
52
    qq!  c.link, c.pos_bilanz, c.pos_eur, c.new_chart_id, c.valid_from, ! .
53
    qq!  c.pos_bwa, ! .
54
    qq!  tk.taxkey_id, tk.pos_ustva, tk.tax_id, ! .
55
    qq!  tk.tax_id || '--' || tk.taxkey_id AS tax, tk.startdate ! .
56
    qq!FROM chart c ! .
57
    qq!LEFT JOIN taxkeys tk ! .
58
    qq!ON (c.id=tk.chart_id AND tk.id = ! .
59
    qq!  (SELECT id FROM taxkeys ! .
60
    qq!   WHERE taxkeys.chart_id = c.id AND startdate <= current_date ! .
61
    qq!   ORDER BY startdate DESC LIMIT 1)) ! .
62
    qq!WHERE c.id = ?!;
63

  
50
  my $query = qq{
51
    SELECT c.accno, c.description, c.charttype, c.category,
52
      c.link, c.pos_bilanz, c.pos_eur, c.new_chart_id, c.valid_from, 
53
      c.pos_bwa, datevautomatik,
54
      tk.taxkey_id, tk.pos_ustva, tk.tax_id,
55
      tk.tax_id || '--' || tk.taxkey_id AS tax, tk.startdate
56
    FROM chart c 
57
    LEFT JOIN taxkeys tk 
58
    ON (c.id=tk.chart_id AND tk.id = 
59
      (SELECT id FROM taxkeys 
60
       WHERE taxkeys.chart_id = c.id AND startdate <= current_date 
61
       ORDER BY startdate DESC LIMIT 1)) 
62
    WHERE c.id = ?
63
    };
64

  
65
  
66
  $main::lxdebug->message(LXDebug::QUERY, "\$query=\n $query");
64 67
  my $sth = $dbh->prepare($query);
65 68
  $sth->execute($form->{id}) || $form->dberror($query . " ($form->{id})");
66 69

  
......
75 78
  # get default accounts
76 79
  $query = qq|SELECT inventory_accno_id, income_accno_id, expense_accno_id
77 80
              FROM defaults|;
81
  $main::lxdebug->message(LXDebug::QUERY, "\$query=\n $query");
78 82
  $sth = $dbh->prepare($query);
79 83
  $sth->execute || $form->dberror($query);
80 84

  
......
84 88

  
85 89
  $sth->finish;
86 90

  
91

  
92

  
87 93
  # get taxkeys and description
88
  $query = qq?SELECT id, taxkey,id||'--'||taxkey AS tax, taxdescription
89
              FROM tax ORDER BY taxkey?;
94
  $query = qq{
95
    SELECT 
96
      id, 
97
      (SELECT accno FROM chart WHERE id=tax.chart_id) AS chart_accno,
98
      taxkey,
99
      id||'--'||taxkey AS tax, 
100
      taxdescription, 
101
      rate
102
    FROM tax ORDER BY taxkey
103
  };
104
  $main::lxdebug->message(LXDebug::QUERY, "\$query=\n $query");
90 105
  $sth = $dbh->prepare($query);
91 106
  $sth->execute || $form->dberror($query);
92 107

  
......
100 115
  if ($form->{id}) {
101 116
    # get new accounts
102 117
    $query = qq|SELECT id, accno,description
103
                FROM chart WHERE link = ?|;
118
                FROM chart 
119
                WHERE link = ? 
120
                ORDER BY accno|;
121
    $main::lxdebug->message(LXDebug::QUERY, "\$query=\n $query");
104 122
    $sth = $dbh->prepare($query);
105 123
    $sth->execute($form->{link}) || $form->dberror($query . " ($form->{link})");
106 124

  
......
110 128
    }
111 129

  
112 130
    $sth->finish;
131

  
132
    # get the taxkeys of account
133
    
134
    $query = qq{
135
      SELECT
136
        tk.id,
137
        tk.chart_id,
138
        c.accno,
139
        tk.tax_id,
140
        t.taxdescription,
141
        t.rate,
142
        tk.taxkey_id, 
143
        tk.pos_ustva, 
144
        tk.startdate
145
      FROM taxkeys tk
146
      LEFT JOIN   tax t ON (t.id = tk.tax_id)
147
      LEFT JOIN chart c ON (c.id = t.chart_id)
148

  
149
      WHERE tk.chart_id = ?
150
      ORDER BY startdate DESC 
151
    };
152
    $main::lxdebug->message(LXDebug::QUERY, "\$query=\n $query");
153
    $sth = $dbh->prepare($query);
154

  
155
    $sth->execute($form->{id}) || $form->dberror($query . " ($form->{id})");
156

  
157
    $form->{ACCOUNT_TAXKEYS} = [];
158

  
159
    while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
160
      push @{ $form->{ACCOUNT_TAXKEYS} }, $ref;
161
    }
162

  
163
    $sth->finish;    
164

  
113 165
  }
114 166
  # check if we have any transactions
115 167
  $query = qq|SELECT a.trans_id FROM acc_trans a
116 168
              WHERE a.chart_id = ?|;
169
  $main::lxdebug->message(LXDebug::QUERY, "\$query=\n $query");
117 170
  $sth = $dbh->prepare($query);
118 171
  $sth->execute($form->{id}) || $form->dberror($query . " ($form->{id})");
119 172

  
......
126 179
  if ($form->{new_chart_id}) {
127 180
    $query = qq|SELECT current_date-valid_from FROM chart
128 181
                WHERE id = ?|;
182
    $main::lxdebug->message(LXDebug::QUERY, "\$query=\n $query");
129 183
    my ($count) = selectrow_query($form, $dbh, $query, $form->{id});
130 184
    if ($count >=0) {
131 185
      $form->{new_chart_valid} = 1;
......
177 231

  
178 232
  my @values;
179 233

  
180
  my ($tax_id, $taxkey) = split(/--/, $form->{tax});
181
  my $startdate = $form->{startdate} ? $form->{startdate} : "1970-01-01";
182

  
183 234
  if ($form->{id}) {
184 235
    $query = qq|UPDATE chart SET
185
                accno = ?, description = ?, charttype = ?,
186
                category = ?, link = ?,
187
                taxkey_id = ?,
188
                pos_ustva = ?, pos_bwa   = ?, pos_bilanz = ?,
189
                pos_eur = ?, new_chart_id = ?, valid_from = ?
236
                  accno = ?, 
237
                  description = ?, 
238
                  charttype = ?,
239
                  category = ?, 
240
                  link = ?,
241
                  pos_bwa   = ?, 
242
                  pos_bilanz = ?,
243
                  pos_eur = ?, 
244
                  new_chart_id = ?, 
245
                  valid_from = ?,
246
                  datevautomatik = ?
190 247
                WHERE id = ?|;
191
    @values = ($form->{accno}, $form->{description}, $form->{charttype},
192
               $form->{category}, $form->{link},
193
               conv_i($taxkey),
194
               conv_i($form->{pos_ustva}), conv_i($form->{pos_bwa}),
195
               conv_i($form->{pos_bilanz}), conv_i($form->{pos_eur}),
196
               conv_i($form->{new_chart_id}),
197
               conv_date($form->{valid_from}),
198
               $form->{id});
199

  
200
  } elsif ($form->{id} && !$form->{new_chart_valid}) {
201
    $query = qq|UPDATE chart SET new_chart_id = ?, valid_from = ?
202
                WHERE id = ?|;
203
    @values = (conv_i($form->{new_chart_id}), conv_date($form->{valid_from}),
204
               $form->{id});
205
  } else {
206
    $query = qq|INSERT INTO chart
207
                (accno, description, charttype,
208
                 category, link, taxkey_id,
209
                 pos_ustva, pos_bwa, pos_bilanz, pos_eur,
210
                 new_chart_id, valid_from)
211
                VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)|;
212
    @values = ($form->{accno}, $form->{description}, $form->{charttype},
213
               $form->{category}, $form->{link}, conv_i($taxkey),
214
               conv_i($form->{pos_ustva}), conv_i($form->{pos_bwa}),
215
               conv_i($form->{pos_bilanz}), conv_i($form->{pos_eur}),
216
               conv_i($form->{new_chart_id}),
217
               conv_date($form->{valid_from}));
248
                
249
    @values = (   
250
                  $form->{accno}, 
251
                  $form->{description}, 
252
                  $form->{charttype},
253
                  $form->{category}, 
254
                  $form->{link},
255
                  conv_i($form->{pos_bwa}),
256
                  conv_i($form->{pos_bilanz}), 
257
                  conv_i($form->{pos_eur}),
258
                  conv_i($form->{new_chart_id}),
259
                  conv_date($form->{valid_from}),
260
                  ($form->{datevautomatik} eq 'T') ? 'true':'false',
261
                $form->{id},
262
    );
263

  
264
  } 
265
  elsif ($form->{id} && !$form->{new_chart_valid}) {
266

  
267
    $query = qq|
268
                  UPDATE chart 
269
                  SET new_chart_id = ?, 
270
                  valid_from = ?
271
                  WHERE id = ?
272
             |;
273
             
274
    @values = (   
275
                  conv_i($form->{new_chart_id}), 
276
                  conv_date($form->{valid_from}),
277
                  $form->{id}
278
              );
279
  } 
280
  else {
281

  
282
    $query = qq|
283
                  INSERT INTO chart (
284
                      accno, 
285
                      description, 
286
                      charttype,
287
                      category, 
288
                      link,
289
                      pos_bwa, 
290
                      pos_bilanz, 
291
                      pos_eur,
292
                      new_chart_id, 
293
                      valid_from,
294
                      datevautomatik )
295
                  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
296
             |;
297

  
298
    @values = (
299
                      $form->{accno}, 
300
                      $form->{description}, 
301
                      $form->{charttype},
302
                      $form->{category}, $form->{link},
303
                      conv_i($form->{pos_bwa}),
304
                      conv_i($form->{pos_bilanz}), conv_i($form->{pos_eur}),
305
                      conv_i($form->{new_chart_id}),
306
                      conv_date($form->{valid_from}),
307
                      ($form->{datevautomatik} eq 'T') ? 'true':'false',
308
              );
218 309

  
219 310
  }
311
  
220 312
  do_query($form, $dbh, $query, @values);
221 313

  
222
  #Save Taxes
223
  if (!$form->{id}) {
224
    $query =
225
      qq|INSERT INTO taxkeys | .
226
      qq|(chart_id, tax_id, taxkey_id, pos_ustva, startdate) | .
227
      qq|VALUES ((SELECT id FROM chart WHERE accno = ?), ?, ?, ?, ?)|;
228
    do_query($form, $dbh, $query,
229
             $form->{accno}, conv_i($tax_id), conv_i($taxkey),
230
             conv_i($form->{pos_ustva}), conv_date($startdate));
314
  #Save Taxkeys
315

  
316
  my @taxkeys = ();
317
  
318
  my $MAX_TRIES = 10; # Maximum count of taxkeys in form
319
  my $tk_count;
320
  
321
  READTAXKEYS:
322
  for $tk_count (0 .. $MAX_TRIES) {
323
    
324
    # Loop control
325
    
326
    # Check if the account already exists, else cancel
327
    last READTAXKEYS if ( $form->{'id'} == 0);
328

  
329
    # check if there is a startdate
330
    if ( $form->{"taxkey_startdate_$tk_count"} eq '' ) {
331
      $tk_count++;
332
      next READTAXKEYS;
333
    }
231 334

  
232
  } else {
233
    $query = qq|DELETE FROM taxkeys WHERE chart_id = ? AND tax_id = ?|;
234
    do_query($form, $dbh, $query, $form->{id}, conv_i($tax_id));
335
    # check if there is at least one relation to pos_ustva or tax_id
336
    if ( $form->{"taxkey_pos_ustva_$tk_count"} eq '' && $form->{"taxkey_tax_$tk_count"} == 0 ) {
337
      $tk_count++;
338
      next READTAXKEYS;
339
    }
235 340

  
236
    $query =
237
      qq|INSERT INTO taxkeys | .
238
      qq|(chart_id, tax_id, taxkey_id, pos_ustva, startdate) | .
239
      qq|VALUES (?, ?, ?, ?, ?)|;
240
    do_query($form, $dbh, $query,
241
             $form->{id}, conv_i($tax_id), conv_i($taxkey),
242
             conv_i($form->{pos_ustva}), conv_date($startdate));
341
    # Add valid taxkeys into the array
342
    push @taxkeys , 
343
      {
344
        id        => ($form->{"taxkey_id_$tk_count"} eq 'NEW') ? conv_i('') : conv_i($form->{"taxkey_id_$tk_count"}),
345
        tax_id    => conv_i($form->{"taxkey_tax_$tk_count"}),
346
        startdate => conv_date($form->{"taxkey_startdate_$tk_count"}),
347
        chart_id  => conv_i($form->{"id"}),
348
        pos_ustva => conv_i($form->{"taxkey_pos_ustva_$tk_count"}),
349
        delete    => ( $form->{"taxkey_del_$tk_count"} eq 'delete' ) ? '1' : '',
350
      };
351
      
352
    $tk_count++;
353
  }
354

  
355
  TAXKEY:
356
  for my $j (0 .. $#taxkeys){
357
    if ( defined $taxkeys[$j]{'id'} ){
358
      # delete Taxkey?
359
      
360
      if ($taxkeys[$j]{'delete'}){
361
        $query = qq{
362
          DELETE FROM taxkeys WHERE id = ?
363
        };
364

  
365
        @values = ($taxkeys[$j]{'id'});
366

  
367
        do_query($form, $dbh, $query, @values);
368
      
369
        next TAXKEY;
370
      }
371

  
372
      # UPDATE Taxkey
373
      
374
      $query = qq{
375
        UPDATE taxkeys
376
        SET taxkey_id = (SELECT taxkey FROM tax WHERE tax.id = ?),
377
            chart_id  = ?,
378
            tax_id    = ?,
379
            pos_ustva = ?,
380
            startdate = ?
381
        WHERE id = ?
382
      };    
383
      @values = (
384
        $taxkeys[$j]{'tax_id'},
385
        $taxkeys[$j]{'chart_id'},
386
        $taxkeys[$j]{'tax_id'}, 
387
        $taxkeys[$j]{'pos_ustva'},
388
        $taxkeys[$j]{'startdate'}, 
389
        $taxkeys[$j]{'id'},  
390
      );
391
      do_query($form, $dbh, $query, @values);
392
    }
393
    else {
394
      # INSERT Taxkey
395
      
396
      $query = qq{
397
        INSERT INTO taxkeys (
398
          taxkey_id,
399
          chart_id,
400
          tax_id,
401
          pos_ustva,
402
          startdate
403
        )
404
        VALUES ((SELECT taxkey FROM tax WHERE tax.id = ?), ?, ?, ?, ?)
405
      };    
406
      @values = (
407
        $taxkeys[$j]{'tax_id'}, 
408
        $taxkeys[$j]{'chart_id'},  
409
        $taxkeys[$j]{'tax_id'}, 
410
        $taxkeys[$j]{'pos_ustva'},
411
        $taxkeys[$j]{'startdate'}, 
412
      );
413
      
414
      do_query($form, $dbh, $query, @values);
415
    }
416
  
243 417
  }
244 418

  
245 419
  # commit
......
289 463
              WHERE id = ?|;
290 464
  do_query($form, $dbh, $query, $form->{id});
291 465

  
466
  # delete account taxkeys
467
  $query = qq|DELETE FROM taxkeys
468
              WHERE chart_id = ?|;
469
  do_query($form, $dbh, $query, $form->{id});
470

  
292 471
  # commit and redirect
293 472
  my $rc = $dbh->commit;
294 473
  $dbh->disconnect;
SL/CA.pm
41 41
sub all_accounts {
42 42
  $main::lxdebug->enter_sub();
43 43

  
44
  my ($self, $myconfig, $form) = @_;
44
  my ($self, $myconfig, $form, $chart_id) = @_;
45 45

  
46 46
  my %amount;
47 47

  
......
61 61
  }
62 62
  $sth->finish;
63 63

  
64
  $query =
65
    qq!SELECT  c.accno, c.id, c.description, c.charttype, c.category, ! .
66
    qq!  c.link, c.pos_bwa, c.pos_bilanz, c.pos_eur, c.valid_from, ! .
67
    qq!  c.datevautomatik, comma(tk.startdate) AS startdate, ! .
68
    qq!  comma(tk.taxkey_id) AS taxkey, ! .
69
    qq!  comma(tx.taxdescription || to_char (tx.rate, '99V99' ) || '%') ! .
70
    qq!    AS taxdescription, ! .
71
    qq!  comma(tx.taxnumber) AS taxaccount, comma(tk.pos_ustva) ! .
72
    qq!    AS tk_ustva, ! .
73
    qq!  ( SELECT accno FROM chart c2 WHERE c2.id = c.id ) AS new_account ! .
74
    qq!FROM chart c ! .
75
    qq!LEFT JOIN taxkeys tk ON (c.id = tk.chart_id) ! .
76
    qq!LEFT JOIN tax tx ON (tk.tax_id = tx.id) ! .
77
    qq!GROUP BY c.accno, c.id, c.description, c.charttype, ! .
78
    qq!  c.category, c.link, c.pos_bwa, c.pos_bilanz, c.pos_eur, ! .
79
    qq!  c.valid_from, c.datevautomatik ! .
80
    qq!ORDER BY c.accno!;
64
  my $where = "AND c.id = $chart_id" if ($chart_id ne '');
65

  
66
  $query = qq{
67
    SELECT 
68
      c.accno,
69
      c.id,
70
      c.description,
71
      c.charttype,
72
      c.category,
73
      c.link,
74
      c.pos_bwa,
75
      c.pos_bilanz,
76
      c.pos_eur,
77
      c.valid_from,
78
      c.datevautomatik,
79
      comma(tk.startdate) AS startdate,
80
      comma(tk.taxkey_id) AS taxkey,
81
      comma(tx.taxdescription || to_char (tx.rate, '99V99' ) || '%') AS taxdescription,
82
      comma(tx.taxnumber) AS taxaccount,
83
      comma(tk.pos_ustva) AS tk_ustva,
84
      ( SELECT accno
85
      FROM chart c2
86
      WHERE c2.id = c.id
87
      ) AS new_account
88
    FROM chart c
89
    LEFT JOIN taxkeys tk ON (c.id = tk.chart_id)
90
    LEFT JOIN tax tx ON (tk.tax_id = tx.id)
91
    WHERE 1=1
92
    $where
93
    GROUP BY c.accno, c.id, c.description, c.charttype, c.gifi_accno,
94
      c.category, c.link, c.pos_bwa, c.pos_bilanz, c.pos_eur, c.valid_from,      
95
      c.datevautomatik
96
    ORDER BY c.accno
97
  };
98

  
81 99
  my $sth = prepare_execute_query($form, $dbh, $query);
82 100

  
83 101
  $form->{CA} = [];
102

  
84 103
  while (my $ca = $sth->fetchrow_hashref(NAME_lc)) {
85 104
    $ca->{amount} = $amount{ $ca->{accno} };
86 105
    if ($ca->{amount} < 0) {
bin/mozilla/am.pl
35 35
use SL::CA;
36 36
use SL::Form;
37 37
use SL::User;
38
use SL::USTVA;
39
use CGI::Ajax;
40
use CGI;
38 41

  
39 42
use Data::Dumper;
40 43

  
......
86 89
sub account_header {
87 90
  $lxdebug->enter_sub();
88 91

  
92
  if ( $form->{action} eq 'edit_account') {
93
    $form->{account_exists} = '1';
94
  } 
95
  
89 96
  $form->{title} = $locale->text("$form->{title} Account");
90 97

  
91
  $checked{ $form->{charttype} } = "checked";
92
  $checked{"$form->{category}_"} = "checked";
93
  $checked{CT_tax} = ($form->{CT_tax}) ? "" : "checked";
98
  $form->{"$form->{charttype}_checked"} = "checked";
99
  $form->{"$form->{category}_checked"}  = "checked";
94 100

  
95
  $form->{description} =~ s/\"/&quot;/g;
101
  $form->{select_tax} = "";
102

  
103
  my @tax_report_pos = USTVA->report_variables({
104
      myconfig   => \%myconfig, 
105
      form       => $form, 
106
      type       => '', 
107
      attribute  => 'position',
108
      calc       => '',
109
  });
96 110

  
97 111
  if (@{ $form->{TAXKEY} }) {
98 112
    foreach my $item (@{ $form->{TAXKEY} }) {
99

  
100 113
      $item->{rate} = $item->{rate} * 100 . '%';
114
    }
101 115

  
102
      if ($item->{tax} == $form->{tax}) {
103
        $form->{selecttaxkey} .=
104
          "<option value=$item->{tax} selected>$item->{taxdescription} ($item->{rate})\n";
105
      } else {
106
        $form->{selecttaxkey} .=
107
          "<option value=$item->{tax}>$item->{taxdescription} ($item->{rate})\n";
108
      }
116
    # Fill in empty row for new Taxkey
117
    $newtaxkey_ref = {
118
      id             => '',
119
      chart_id       => '',
120
      accno          => '',
121
      tax_id         => '',
122
      taxdescription => '',
123
      rate           => '',
124
      taxkey_id      => '',
125
      pos_ustva      => '',
126
      startdate      => '',
127
    };
128

  
129
    push @{ $form->{ACCOUNT_TAXKEYS} }, $newtaxkey_ref;
130

  
131
    my $i = 0;
132
    foreach my $taxkey_used (@{ $form->{ACCOUNT_TAXKEYS} } ) {
133

  
134
      # Fill in a runningnumber
135
      $form->{ACCOUNT_TAXKEYS}[$i]{runningnumber} = $i;
136

  
137
      # Fill in the Taxkeys as select options
138
      foreach my $item (@{ $form->{TAXKEY} }) {
139
        if ($item->{id} == $taxkey_used->{tax_id}) {
140
          $form->{ACCOUNT_TAXKEYS}[$i]{selecttaxkey} .=
141
            qq|<option value="$item->{id}" selected="selected">|
142
            . sprintf("%.2d", $item->{taxkey}) 
143
            . qq|. $item->{taxdescription} ($item->{rate}) |
144
            . $locale->text('Tax-o-matic Account: ') 
145
            . qq|$item->{chart_accno}\n|;
146
        } 
147
        else {
148
          $form->{ACCOUNT_TAXKEYS}[$i]{selecttaxkey} .=
149
            qq|<option value="$item->{id}">|
150
            . sprintf("%.2d", $item->{taxkey}) 
151
            . qq|. $item->{taxdescription} ($item->{rate}) |
152
            . $locale->text('Tax-o-matic Account: ')
153
            . qq|$item->{chart_accno}\n|;
154
        }
109 155

  
156
      }
157
      
158
      # Fill in the USTVA Numbers as select options
159
      foreach my $item ( '', sort({ $a cmp $b } @tax_report_pos) ) {
160
        if ($item eq ''){
161
          $form->{ACCOUNT_TAXKEYS}[$i]{select_tax} .= qq|<option value="" selected="selected">-\n|;
162
        } 
163
        elsif ( $item == $taxkey_used->{pos_ustva} ) {
164
          $form->{ACCOUNT_TAXKEYS}[$i]{select_tax} .= qq|<option value="$item" selected="selected">$item\n|;
165
        }
166
        else {
167
          $form->{ACCOUNT_TAXKEYS}[$i]{select_tax} .= qq|<option value="$item">$item\n|;
168
        }
169

  
170
      }      
171

  
172
      $i++;
110 173
    }
111 174
  }
112 175

  
113
  $taxkey = qq|
114
	      <tr>
115
		<th align=right>| . $locale->text('Steuersatz') . qq|</th>
116
		<td><select name=tax>$form->{selecttaxkey}</select></td>
117
		<th align=right>| . $locale->text('G?ltig ab') . qq|</th>
118
                <td><input name=startdate value="$form->{startdate}"></td>
119
	      </tr>|;
120

  
176
  # Newaccount Folgekonto 
121 177
  if (@{ $form->{NEWACCOUNT} }) {
122 178
    if (!$form->{new_chart_valid}) {
123
      $form->{selectnewaccount} = "<option value=></option>";
179
      $form->{selectnewaccount} = qq|<option value=""> |. $locale->text('None') .q|</option>|;
124 180
    }
125 181
    foreach $item (@{ $form->{NEWACCOUNT} }) {
126 182
      if ($item->{id} == $form->{new_chart_id}) {
127 183
        $form->{selectnewaccount} .=
128
          "<option value=$item->{id} selected>$item->{accno}--$item->{description}</option>";
184
          qq|<option value="$item->{id}" selected>$item->{accno}--$item->{description}</option>|;
129 185
      } elsif (!$form->{new_chart_valid}) {
130 186
        $form->{selectnewaccount} .=
131
          "<option value=$item->{id}>$item->{accno}--$item->{description}</option>";
187
          qq|<option value="$item->{id}">$item->{accno}--$item->{description}</option>|;
132 188
      }
133 189

  
134 190
    }
135 191
  }
136 192

  
137
  $newaccount = qq|
138
	      <tr>
139
                <td colspan=2>
140
                  <table>
141
                    <tr>
142
		      <th align=right>| . $locale->text('Folgekonto') . qq|</th>
143
		      <td><select name=new_chart_id>$form->{selectnewaccount}</select></td>
144
                      <th align=right>| . $locale->text('G?ltig ab') . qq|</th>
145
		      <td><input name=valid_from value="$form->{valid_from}"></td>
146
                    </tr>
147
                  </table>
148
                </td>
149
	      </tr>|;
150

  
151
  $form->{selectustva} = "<option>\n";
152

  
153
  %ustva = (35  => $locale->text('UStVA-Nr. 35'),
154
            36  => $locale->text('UStVA-Nr. 36'),
155
            39  => $locale->text('UStVA-Nr. 39'),
156
            41  => $locale->text('UStVA-Nr. 41'),
157
            42  => $locale->text('UStVA-Nr. 42'),
158
            43  => $locale->text('UStVA-Nr. 43'),
159
            44  => $locale->text('UStVA-Nr. 44'),
160
            45  => $locale->text('UStVA-Nr. 45'),
161
            48  => $locale->text('UStVA-Nr. 48'),
162
            49  => $locale->text('UStVA-Nr. 49'),
163
            51  => $locale->text('UStVA-Nr. 51 left'),
164
            511 => $locale->text('UStVA-Nr. 51 right'),
165
            52  => $locale->text('UStVA-Nr. 52'),
166
            53  => $locale->text('UStVA-Nr. 53'),
167
            59  => $locale->text('UStVA-Nr. 59'),
168
            60  => $locale->text('UStVA-Nr. 60'),
169
            61  => $locale->text('UStVA-Nr. 61'),
170
            62  => $locale->text('UStVA-Nr. 62'),
171
            63  => $locale->text('UStVA-Nr. 63'),
172
            64  => $locale->text('UStVA-Nr. 64'),
173
            65  => $locale->text('UStVA-Nr. 65'),
174
            66  => $locale->text('UStVA-Nr. 66'),
175
            67  => $locale->text('UStVA-Nr. 67'),
176
            69  => $locale->text('UStVA-Nr. 69'),
177
            73  => $locale->text('UStVA-Nr. 73'),
178
            74  => $locale->text('UStVA-Nr. 74'),
179
            76  => $locale->text('UStVA-Nr. 76'),
180
            77  => $locale->text('UStVA-Nr. 77'),
181
            80  => $locale->text('UStVA-Nr. 80'),
182
            81  => $locale->text('UStVA-Nr. 81 left'),
183
            811 => $locale->text('UStVA-Nr. 81 right'),
184
            84  => $locale->text('UStVA-Nr. 84'),
185
            85  => $locale->text('UStVA-Nr. 85'),
186
            86  => $locale->text('UStVA-Nr. 86 left'),
187
            861 => $locale->text('UStVA-Nr. 86 right'),
188
            89  => $locale->text('UStVA-Nr. 89 left'),
189
            891 => $locale->text('UStVA-Nr. 89 right'),
190
            91  => $locale->text('UStVA-Nr. 91'),
191
            93  => $locale->text('UStVA-Nr. 93 left'),
192
            931 => $locale->text('UStVA-Nr. 93 right'),
193
            94  => $locale->text('UStVA-Nr. 94'),
194
            95  => $locale->text('UStVA-Nr. 95'),
195
            96  => $locale->text('UStVA-Nr. 96'),
196
            97  => $locale->text('UStVA-Nr. 97 links'),
197
            971 => $locale->text('UStVA-Nr. 97 rechts'),
198
            98  => $locale->text('UStVA-Nr. 98'));
199

  
200
  foreach $item (sort({ $a cmp $b } keys %ustva)) {
201
    if ($item == $form->{pos_ustva}) {
202
      $form->{selectustva} .= "<option value=$item selected>$ustva{$item}\n";
203
    } else {
204
      $form->{selectustva} .= "<option value=$item>$ustva{$item}\n";
205
    }
206

  
207
  }
208

  
209
  $ustva = qq|
210
	      <tr>
211
		<th align=right>| . $locale->text('Umsatzsteuervoranmeldung') . qq|</th>
212
		<td><select name=pos_ustva>$form->{selectustva}</select></td>
213
		<input type=hidden name=selectustva value="$form->{selectustva}">
214
	      </tr>|;
215

  
216
  $form->{selecteur} = "<option>\n";
193
  $select_eur = q|<option value=""> |. $locale->text('None') .q|</option>\n|;
217 194
  %eur = (1  => "Umsatzerl?se",
218 195
          2  => "sonstige Erl?se",
219 196
          3  => "Privatanteile",
......
247 224
          31 => "Betriebliche Steuern");
248 225
  foreach $item (sort({ $a <=> $b } keys(%eur))) {
249 226
    if ($item == $form->{pos_eur}) {
250
      $form->{selecteur} .= "<option value=$item selected>$eur{$item}\n";
227
      $select_eur .= qq|<option value=$item selected>|. sprintf("%.2d", $item) .qq|. $eur{$item}</option>\n|;
251 228
    } else {
252
      $form->{selecteur} .= "<option value=$item>$eur{$item}\n";
229
      $select_eur .= qq|<option value=$item>|. sprintf("%.2d", $item) .qq|. $eur{$item}</option>\n|;
253 230
    }
254 231

  
255 232
  }
256 233

  
257
  $eur = qq|
258
	      <tr>
259
		<th align=right>| . $locale->text('EUER') . qq|</th>
260
		<td><select name=pos_eur>$form->{selecteur}</select></td>
261
		<input type=hidden name=selecteur value="$form->{selecteur}">
262
	      </tr>|;
263

  
264
  $form->{selectbwa} = "<option>\n";
234
  $select_bwa = q|<option value=""> |. $locale->text('None') .q|</option>\n|;
265 235

  
266 236
  %bwapos = (1  => 'Umsatzerl?se',
267 237
             2  => 'Best.Verdg.FE/UE',
......
287 257
             35 => 'Steuern Eink.u.Ertr.');
288 258
  foreach $item (sort({ $a <=> $b } keys %bwapos)) {
289 259
    if ($item == $form->{pos_bwa}) {
290
      $form->{selectbwa} .= "<option value=$item selected>$bwapos{$item}\n";
260
      $select_bwa .= qq|<option value="$item" selected>|. sprintf("%.2d", $item) .qq|. $bwapos{$item}\n|;
291 261
    } else {
292
      $form->{selectbwa} .= "<option value=$item>$bwapos{$item}\n";
262
      $select_bwa .= qq|<option value="$item">|. sprintf("%.2d", $item) .qq|. $bwapos{$item}\n|;
293 263
    }
294 264

  
295 265
  }
296 266

  
297
  $bwa = qq|
298
	      <tr>
299
		<th align=right>| . $locale->text('BWA') . qq|</th>
300
		<td><select name=pos_bwa>$form->{selectbwa}</select></td>
301
		<input type=hidden name=selectbwa value="$form->{selectbwa}">
302
	      </tr>|;
267
# Wieder hinzugef?gt zu evaluationszwecken (us) 09.03.2007
268
  $select_bilanz = q|<option value=""> |. $locale->text('None') .q|</option>\n|;
269
  foreach $item ((1, 2, 3, 4)) {
270
    if ($item == $form->{pos_bilanz}) {
271
      $select_bilanz .= qq|<option value=$item selected>|. sprintf("%.2d", $item) .qq|.\n|;
272
    } else {
273
      $select_bilanz .= qq|<option value=$item>|. sprintf("%.2d", $item) .qq|.\n|;
274
    }
303 275

  
304
# Entfernt bis es ordentlich umgesetzt wird (hli) 30.03.2006
305
#  $form->{selectbilanz} = "<option>\n";
306
#  foreach $item ((1, 2, 3, 4)) {
307
#    if ($item == $form->{pos_bilanz}) {
308
#      $form->{selectbilanz} .= "<option value=$item selected>$item\n";
309
#    } else {
310
#      $form->{selectbilanz} .= "<option value=$item>$item\n";
311
#    }
312
#
313
#  }
314
#
315
#  $bilanz = qq|
316
#	      <tr>
317
#		<th align=right>| . $locale->text('Bilanz') . qq|</th>
318
#		<td><select name=pos_bilanz>$form->{selectbilanz}</select></td>
319
#		<input type=hidden name=selectbilanz value="$form->{selectbilanz}">
320
#	      </tr>|;
321

  
322
  # this is for our parser only!
276
  }
277

  
278
  # this is for our parser only! Do not remove.
323 279
  # type=submit $locale->text('Add Account')
324 280
  # type=submit $locale->text('Edit Account')
281
  
325 282
  $form->{type} = "account";
326 283

  
327
  $form->header;
328

  
329
  print qq|
330
<body>
331

  
332
<form method=post action=$form->{script}>
284
  # preselections category
285
 
286
  $select_category = q|<option value=""> |. $locale->text('None') .q|</option>\n|;
287

  
288
  %category = (
289
      'A'  => $locale->text('Asset'),
290
      'L'  => $locale->text('Liability'),
291
      'Q'  => $locale->text('Equity'),
292
      'I'  => $locale->text('Revenue'),      
293
      'E'  => $locale->text('Expense'),
294
      'C'  => $locale->text('Costs'),
295
  );
296
  foreach $item ( sort({ $a <=> $b } keys %category) ) {
297
    if ($item eq $form->{category}) {
298
      $select_category .= qq|<option value="$item" selected="selected">$category{$item} (|. sprintf("%s", $item) .qq|)\n|;
299
    } else {
300
      $select_category .= qq|<option value="$item">$category{$item} (|. sprintf("%s", $item) .qq|)\n|;
301
    }
333 302

  
334
<input type=hidden name=id value=$form->{id}>
335
<input type=hidden name=type value=account>
336
<input type=hidden name=orphaned value=$form->{orphaned}>
337
<input type=hidden name=new_chart_valid value=$form->{new_chart_valid}>
303
  }
304
  
305
  # preselection chart type
306
  my $select_charttype = q{};
338 307

  
339
<input type=hidden name=inventory_accno_id value=$form->{inventory_accno_id}>
340
<input type=hidden name=income_accno_id value=$form->{income_accno_id}>
341
<input type=hidden name=expense_accno_id value=$form->{expense_accno_id}>
342
<input type=hidden name=fxgain_accno_id value=$form->{fxgain_accno_id}>
343
<input type=hidden name=fxloss_accno_id value=$form->{fxloss_accno_id}>
308
  my %charttype = (
309
      'A'  => $locale->text('Account'),
310
      'H'  => $locale->text('Header'),
311
  );
312
  
313
  foreach $item ( sort({ $a <=> $b } keys %charttype) ) {
314
    if ($item eq $form->{charttype}) {
315
      $select_charttype .= qq|<option value="$item" selected="selected">$charttype{$item}\n|;
344 316

  
345
<table border=0 width=100%>
346
  <tr>
347
    <th class=listtop>$form->{title}</th>
348
  </tr>
349
  <tr height="5"></tr>
350
  <tr valign=top>
351
    <td>
352
      <table>
353
	<tr>
354
	  <th align=right>| . $locale->text('Account Number') . qq|</th>
355
	  <td><input name=accno size=20 value=$form->{accno}></td>
356
	</tr>
357
	<tr>
358
	  <th align=right>| . $locale->text('Description') . qq|</th>
359
	  <td><input name=description size=40 value="$form->{description}"></td>
360
	</tr>
361
	<tr>
362
	  <th align=right>| . $locale->text('Account Type') . qq|</th>
363
	  <td>
364
	    <table>
365
	      <tr valign=top>
366
		<td><input name=category type=radio class=radio value=A $checked{A_}>&nbsp;|
367
    . $locale->text('Asset') . qq|\n<br>
368
		<input name=category type=radio class=radio value=L $checked{L_}>&nbsp;|
369
    . $locale->text('Liability') . qq|\n<br>
370
		<input name=category type=radio class=radio value=Q $checked{Q_}>&nbsp;|
371
    . $locale->text('Equity') . qq|\n<br>
372
		<input name=category type=radio class=radio value=I $checked{I_}>&nbsp;|
373
    . $locale->text('Revenue') . qq|\n<br>
374
		<input name=category type=radio class=radio value=E $checked{E_}>&nbsp;|
375
    . $locale->text('Expense') . qq|<br>
376
		<input name=category type=radio class=radio value=C $checked{C_}>&nbsp;|
377
    . $locale->text('Costs') . qq|</td>
378
		<td width=50>&nbsp;</td>
379
		<td>
380
		<input name=charttype type=radio class=radio value="H" $checked{H}>&nbsp;|
381
    . $locale->text('Heading') . qq|<br>
382
		<input name=charttype type=radio class=radio value="A" $checked{A}>&nbsp;|
383
    . $locale->text('Account') . qq|</td>
384
	      </tr>
385
	    </table>
386
	  </td>
387
	</tr>
388
|;
317
    } else {
318
      $select_charttype .= qq|<option value="$item">$charttype{$item}\n|;
319
    }
389 320

  
390
  if ($form->{charttype} eq "A") {
391
    print qq|
392
	<tr>
393
	  <td colspan=2>
394
	    <table>
395
	      <tr>
396
		<th align=left>|
397
      . $locale->text('Is this a summary account to record') . qq|</th>
398
		<td>
399
		<input name=AR type=checkbox class=checkbox value=AR $form->{AR}>&nbsp;|
400
      . $locale->text('AR')
401
      . qq|&nbsp;<input name=AP type=checkbox class=checkbox value=AP $form->{AP}>&nbsp;|
402
      . $locale->text('AP')
403
      . qq|&nbsp;<input name=IC type=checkbox class=checkbox value=IC $form->{IC}>&nbsp;|
404
      . $locale->text('Inventory')
405
      . qq|</td>
406
	      </tr>
407
	    </table>
408
	  </td>
409
	</tr>
410
	<tr>
411
	  <th colspan=2>| . $locale->text('Include in drop-down menus') . qq|</th>
412
	</tr>
413
	<tr valign=top>
414
	  <td colspan=2>
415
	    <table width=100%>
416
	      <tr>
417
		<th align=left>| . $locale->text('Receivables') . qq|</th>
418
		<th align=left>| . $locale->text('Payables') . qq|</th>
419
		<th align=left>| . $locale->text('Parts Inventory') . qq|</th>
420
		<th align=left>| . $locale->text('Service Items') . qq|</th>
421
	      </tr>
422
	      <tr>
423
		<td>
424
		<input name=AR_amount type=checkbox class=checkbox value=AR_amount $form->{AR_amount}>&nbsp;|
425
      . $locale->text('Revenue') . qq|\n<br>
426
		<input name=AR_paid type=checkbox class=checkbox value=AR_paid $form->{AR_paid}>&nbsp;|
427
      . $locale->text('Receipt') . qq|\n<br>
428
		<input name=AR_tax type=checkbox class=checkbox value=AR_tax $form->{AR_tax}>&nbsp;|
429
      . $locale->text('Tax') . qq|
430
		</td>
431
		<td>
432
		<input name=AP_amount type=checkbox class=checkbox value=AP_amount $form->{AP_amount}>&nbsp;|
433
      . $locale->text('Expense/Asset') . qq|\n<br>
434
		<input name=AP_paid type=checkbox class=checkbox value=AP_paid $form->{AP_paid}>&nbsp;|
435
      . $locale->text('Payment') . qq|\n<br>
436
		<input name=AP_tax type=checkbox class=checkbox value=AP_tax $form->{AP_tax}>&nbsp;|
437
      . $locale->text('Tax') . qq|
438
		</td>
439
		<td>
440
		<input name=IC_sale type=checkbox class=checkbox value=IC_sale $form->{IC_sale}>&nbsp;|
441
      . $locale->text('Revenue') . qq|\n<br>
442
		<input name=IC_cogs type=checkbox class=checkbox value=IC_cogs $form->{IC_cogs}>&nbsp;|
443
      . $locale->text('Expense') . qq|\n<br>
444
		<input name=IC_taxpart type=checkbox class=checkbox value=IC_taxpart $form->{IC_taxpart}>&nbsp;|
445
      . $locale->text('Tax') . qq|
446
		</td>
447
		<td>
448
		<input name=IC_income type=checkbox class=checkbox value=IC_income $form->{IC_income}>&nbsp;|
449
      . $locale->text('Revenue') . qq|\n<br>
450
		<input name=IC_expense type=checkbox class=checkbox value=IC_expense $form->{IC_expense}>&nbsp;|
451
      . $locale->text('Expense') . qq|\n<br>
452
		<input name=IC_taxservice type=checkbox class=checkbox value=IC_taxservice $form->{IC_taxservice}>&nbsp;|
453
      . $locale->text('Tax') . qq|
454
		</td>
455
	      </tr>
456
	    </table>
457
	  </td>
458
	</tr>
459
|;
460 321
  }
461 322

  
462
  print qq|
463
        $taxkey
464
        $ustva
465
        $eur
466
	$bwa
467
        $bilanz
468
      </table>
469
    </td>
470
  </tr>
471
  $newaccount
472
  <tr>
473
    <td><hr size=3 noshade></td>
474
  </tr>
475
</table>
476
|;
323
  my $ChartTypeIsAccount = ($form->{charttype} eq "A") ? "1":"";
324
  
325
  $form->header();
326
  
327
  my $parameters_ref = {
328
    ChartTypeIsAccount         => $ChartTypeIsAccount,
329
    select_category            => $select_category,
330
    select_charttype           => $select_charttype,
331
    newaccount                 => $newaccount,
332
    checked                    => $checked,
333
    select_bwa                 => $select_bwa,
334
    select_bilanz              => $select_bilanz,
335
    select_eur                 => $select_eur,
336
  };
337
  
338
  # Ausgabe des Templates
339
  print($form->parse_html_template('am/edit_accounts', $parameters_ref));
340

  
477 341

  
478 342
  $lxdebug->leave_sub();
479 343
}
......
514 378
sub save_account {
515 379
  $lxdebug->enter_sub();
516 380

  
517
  $form->isblank("accno",    $locale->text('Account Number missing!'));
518
  $form->isblank("category", $locale->text('Account Type missing!'));
381
  $form->isblank("accno",       $locale->text('Account Number missing!'));
382
  $form->isblank("description", $locale->text('Account Description missing!'));
383
  
384
  if ($form->{charttype} eq 'A'){
385
    $form->isblank("category",  $locale->text('Account Type missing!'));
386
  }
519 387

  
520 388
  $form->redirect($locale->text('Account saved!'))
521 389
    if (AM->save_account(\%myconfig, \%$form));
......
535 403
  $callback =
536 404
    "$form->{script}?action=list_account&login=$form->{login}&password=$form->{password}";
537 405

  
406

  
407

  
408
  # escape callback
409
  $callback = $form->escape($callback);
410

  
411
  foreach $ca (@{ $form->{CA} }) {
412

  
413
    $ca->{debit}  = "&nbsp;";
414
    $ca->{credit} = "&nbsp;";
415

  
416
    if ($ca->{amount} > 0) {
417
      $ca->{credit} =
418
        $form->format_amount(\%myconfig, $ca->{amount}, 2, "&nbsp;");
419
    }
420
    if ($ca->{amount} < 0) {
421
      $ca->{debit} =
422
        $form->format_amount(\%myconfig, -1 * $ca->{amount}, 2, "&nbsp;");
423
    }
424
    $ca->{heading}   = ( $ca->{charttype} eq 'H' ) ? 1:''; 
425
    $ca->{link_edit_account} = 
426
        qq|$form->{script}?action=edit_account&id=$ca->{id}|
427
       .qq|&path=$form->{path}&login=$form->{login}|
428
       .qq|&password=$form->{password}&callback=$callback|;
429
  }
430
  
431
  # Ajax 
432
  my $list_account_details_url = 
433
              "$form->{script}?login=$form->{login}&path=$form->{path}"
434
             ."&password=$form->{password}&action=list_account_details&";
435
  
436
  
437
  my $pjx = new CGI::Ajax( 
438
             'list_account_details' => $list_account_details_url 
439
  );
440

  
441
  # Eneable AJAX debuging
442
  #$pjx->DEBUG(1);
443
  #$pjx->JSDEBUG(1);
444
    
445
  push(@ { $form->{AJAX} }, $pjx);
446
  
447
  $form->header;
448
  
449
  
450
  my $parameters_ref = {
451
  #   hidden_variables                => $_hidden_variables_ref,
452
  };
453
  
454
  # Ausgabe des Templates
455
  print($form->parse_html_template('am/list_accounts', $parameters_ref));
456
  
457
  $lxdebug->leave_sub();
458

  
459
}
460

  
461

  
462
sub list_account_details {
463
# Ajax Funktion aus list_account_details  
464
  $lxdebug->enter_sub();
465

  
466
  my $chart_id = $form->{args};
467
  
468
  CA->all_accounts(\%myconfig, \%$form, $chart_id);
469

  
470
  $form->{title} = $locale->text('Chart of Accounts');
471

  
472
  # construct callback
473
  $callback =
474
    "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&password=$form->{password}";
475

  
538 476
  $form->header;
539 477

  
540 478
  # escape callback
......
551 489
    }
552 490
    if ($ca->{amount} < 0) {
553 491
      $ca->{debit} =
554
        $form->format_amount(\%myconfig, -$ca->{amount}, 2, "&nbsp;");
492
        $form->format_amount(\%myconfig, -1 * $ca->{amount}, 2, "&nbsp;");
555 493
    }
556 494

  
557 495
    my @links = split( q{:}, $ca->{link});
......
574 512
               : ( $link eq 'IC_income' )     ? $locale->text('Account Link IC_income')
575 513
               : ( $link eq 'IC_expense' )    ? $locale->text('Account Link IC_expense')
576 514
               : ( $link eq 'IC_taxservice' ) ? $locale->text('Account Link IC_taxservice')
577
               : ( $link eq 'CT_tax' )        ? $locale->text('Account Link CT_tax')
515
#               : ( $link eq 'CT_tax' )        ? $locale->text('Account Link CT_tax')
578 516
               : $locale->text('Unknown Link') . ': ' . $link;
579 517
      
580
      $ca->{link} .= qq|[| . $link . qq|]&nbsp;|;
518
      $ca->{link} .= ($link ne '') ?  "[$link] ":'';
581 519
    }
582 520
    
583 521
    $ca->{startdate}      =~ s/,/<br>/og;
......
585 523
    $ca->{taxkey}         =~ s/,/<br>/og;
586 524
    $ca->{taxaccount}     =~ s/,/<br>/og;
587 525
    $ca->{taxdescription} =~ s/,/<br>/og;
588
    $ca->{datevautomatik} = ($ca->{datevautomatik}) ? $locale->text('On'):q{};
526
    $ca->{datevautomatik} = ($ca->{datevautomatik}) ? $locale->text('On'):$locale->text('Off');
589 527

  
590 528
    $ca->{category} = ($ca->{category} eq 'A') ? $locale->text('Account Category A')
591 529
                    : ($ca->{category} eq 'E') ? $locale->text('Account Category E')
......
601 539
       .qq|&login=$form->{login}|
602 540
       .qq|&password=$form->{password}&callback=$callback|;
603 541
  }
604
  
542

  
543

  
544

  
545

  
605 546
  my $parameters_ref = {
606 547
  
607 548
  
......
609 550
  };
610 551
  
611 552
  # Ausgabe des Templates
612
  print($form->parse_html_template('am/list_accounts', $parameters_ref));
553
  #my $q = CGI->new();
554
  my $result = $form->parse_html_template('am/list_account_details', $parameters_ref);
613 555
  
556
  print $result;
557
#  print "chart_id:$chart_id, form->chartid:$form->{chart_id}, rest=$rest";
558
      
614 559
  $lxdebug->leave_sub();
615
  
616 560

  
617 561
}
618 562

  
css/lx-office-erp.css
123 123
	border-style:dotted;
124 124
	border-width:thin;
125 125
}
126
	
127
	
126

  
127
.accountlistheading { 
128
	font-size: 10pt; 
129
	padding:3px;
130
	color: white; 
131
	font-weight: bold;
132
	text-align:left;
133
	background-color:rgb(133,132,129);
134
}
135

  
128 136
.subsubheading {
129 137
  color: black;
130 138
  font-weight: bolder;
......
181 189
  font-size: 14pt;
182 190
}
183 191

  
192
fieldset {
193
  margin-top:15px;
194
  color: black;
195
  font-weight: bolder;
196
}
184 197

  
185 198
/* media stuff */
186 199

  
js/FormManager.js
1
/*
2
	Form Manager: A simple method of constructing complex dynamic forms.
3
	Written by Twey, http://www.twey.co.uk/.
4
	Use, copying, and modification allowed, so long as credit
5
	remains intact, under the terms of the GNU General Public License,
6
	version 2 or later. See http://www.gnu.org/copyleft/gpl.html for details.
7
*/
8

  
9

  
10
var FORM_MANAGER_CONDITION_SEPARATOR = " AND ";
11
var FORM_MANAGER_POSSIBILITY_SEPARATOR = " OR ";
12
var FORM_MANAGER_NAME_VALUE_SEPARATOR = " BEING ";
13
var FORM_MANAGER_DEPENDS = "DEPENDS ON ";
14
var FORM_MANAGER_CONFLICTS = "CONFLICTS WITH ";
15
var FORM_MANAGER_EMPTY = "EMPTY";
16

  
17
function addEvent(el, ev, f) {
18
  if(el.addEventListener)
19
    el.addEventListener(ev, f, false);
20
  else if(el.attachEvent) {
21
    var t = function() {
22
      f.apply(el);
23
    };
24
    addEvent.events.push({'element': el, 'event': ev, 'handler': f});
25
    el.attachEvent("on" + ev, t);
26
  } else
27
    el['on' + ev] = f;
28
}
29

  
30
function addEvents(els, evs, f) {
31
  for(var i = 0; i < els.length; ++i)
32
    for(var j = 0; j < evs.length; ++j)
33
      addEvent(els[i], evs[j], f);
34
}
35

  
36
addEvent.events = [];
37

  
38
if(typeof window.event !== "undefined")
39
  addEvent(window, "unload", function() {
40
      for(var i = 0, e = addEvent.events; i < e.length; ++i)
41
        e[i].element.detachEvent("on" + e[i].event, e[i].handler);
42
    }
43
  );
44

  
45
function getRadioValue(el) {
46
  if(!el.length) return null;
47
  for(var i = 0; i < el.length; ++i)
48
    if(el[i].checked) return el[i].value;
49
  return null;
50
}
51

  
52
function getSelectValue(el) {
53
  if(!el.tagName  || el.tagName.toLowerCase() !== "select")
54
    return null;
55
  return el.options[el.selectedIndex].value;
56
}
57

  
58
function isElementValue(el, v) {
59
  if(v === FORM_MANAGER_EMPTY) v = '';
60
  return (
61
    getRadioValue(el) == v ||
62
    getSelectValue(el) == v ||
63
    (
64
      el.tagName &&
65
      el.tagName.toLowerCase() !== "select" &&
66
      el.value == v
67
    )
68
  );
69
}
70

  
71
function setupDependencies() {
72
  var showEl = function() {
73
    this.style.display = "";
74
    if(this.parentNode.tagName.toLowerCase() == "label")
75
      this.parentNode.style.display = "";
76
  };
77
  var hideEl = function() {
78
    this.style.display = "none";
79
    if(typeof this.checked !== "undefined") this.checked = false;
80
    else this.value = "";
81
    if(this.parentNode.tagName.toLowerCase() == "label")
82
      this.parentNode.style.display = "none";
83
    this.hidden = true;
84
  };
85
  var calcDeps = function() {
86
    for(var i = 0, e = this.elements; i < e.length; ++i) {
87
      e[i].hidden = false;
88
      for(var j = 0, f = e[i].className.split(FORM_MANAGER_CONDITION_SEPARATOR); j < f.length; ++j)
89
        if(f[j].indexOf(FORM_MANAGER_DEPENDS) === 0) {
90
          for(var k = 0, g = f[j].substr(FORM_MANAGER_DEPENDS.length).split(FORM_MANAGER_POSSIBILITY_SEPARATOR); k < g.length; ++k)
91
            if(g[k].indexOf(FORM_MANAGER_NAME_VALUE_SEPARATOR) === -1) {
92
	      if(e[g[k]] && e[g[k]].checked) break;
93
            else if(k + 1 == g.length)
94
                e[i].hide();
95
            } else {
96
              var n = g[k].split(FORM_MANAGER_NAME_VALUE_SEPARATOR),
97
                v = n[1];
98
              n = n[0];
99
	      if(e[n])
100
	        if(isElementValue(e[n], v)) break;
101
	        else if(k + 1 == g.length) e[i].hide();
102
	    }
103
        } else if(f[j].indexOf(FORM_MANAGER_CONFLICTS) === 0) {
104
          if(f[j].indexOf(FORM_MANAGER_NAME_VALUE_SEPARATOR) === -1) {
105
	    if(e[f[j].substr(FORM_MANAGER_CONFLICTS.length)] && e[f[j].substr(FORM_MANAGER_CONFLICTS.length)].checked) {
106
              e[i].hide();
107
              break;
108
            }
109
          } else {
110
            var n = f[j].substr(FORM_MANAGER_CONFLICTS.length).split(FORM_MANAGER_NAME_VALUE_SEPARATOR),
111
              v = n[1];
112
            n = n[0];
113
            if(e[n]) {
114
              if(isElementValue(e[n], v)) {
115
                e[i].hide();
116
                break;
117
              }
118
            }
119
          }
120
        }
121
      if(!e[i].hidden) e[i].show();
122
    }
123
  };
124
  var changeHandler = function() {
125
    this.form.calculateDependencies();
126
    return true;
127
  };
128
  for(var i = 0; i < arguments.length; ++i) {
129
    for(var j = 0, e = window.document.forms[arguments[i]].elements; j < e.length; ++j) {
130
      addEvents([e[j]], ["change", "keyup", "focus", "click", "keydown"], changeHandler);
131
      e[j].hide = hideEl;
132
      e[j].show = showEl;
133
    }
134

  
135
    (e = window.document.forms[arguments[i]]).calculateDependencies = calcDeps;
136
    e.calculateDependencies();
137
  }
138
}
locale/de/all
51 51
  'Account Category I'          => 'Erl?skonto',
52 52
  'Account Category L'          => 'Passiva/Mittelherkunft',
53 53
  'Account Category Q'          => 'Passiva',
54
  'Account ID'                  => 'Konto-ID',
54
  'Account Description missing!' => 'Beschreibung fehlt!',
55 55
  'Account Link AP'             => 'Einkauf',
56 56
  'Account Link AP_amount'      => 'Verbindlichkeiten Aufwand/Anlagen',
57 57
  'Account Link AP_paid'        => 'Verbindlichkeiten Zahlungsausgang',
......
248 248
  'Change Admin Password'       => 'Administratorpasswort ?ndern',
249 249
  'Change Password'             => 'Passwort ?ndern',
250 250
  'Character Set'               => 'Zeichensatz',
251
  'Chart Type'                  => 'Kontentyp',
251 252
  'Chart of Accounts'           => 'Konten?bersicht',
252 253
  'Chart of accounts'           => 'Kontenrahmen',
253 254
  'Check'                       => '',
......
340 341
  'Date Paid'                   => 'Zahlungsdatum',
341 342
  'Date missing!'               => 'Datum fehlt!',
342 343
  'Datentr?gernummer'           => 'Datentr?gernummer',
343
  'Datev'                       => '',
344
  'Datevautomatik'              => 'Datevexport',
344 345
  'Datum von'                   => 'Datum von',
345 346
  'Debit'                       => 'Soll',
346 347
  'Debit Account'               => 'Sollkonto',
......
367 368
  'Dependency loop detected:'   => 'Schleife in den Abh&auml;ngigkeiten entdeckt:',
368 369
  'Deposit'                     => 'Gutschrift',
369 370
  'Description'                 => 'Beschreibung',
371
  'Description (Click on Description for details)' => 'Beschreibung (Klick
372
  ?ffnet einzelne Kontendetails)',
370 373
  'Description missing!'        => 'Beschreibung fehlt.',
371 374
  'Description must not be empty!' => 'Beschreibung darf nicht leer sein',
372 375
  'Difference'                  => 'Differenz',
......
518 521
  'G?ltig ab'                   => 'G?ltig ab',
519 522
  'HTML'                        => 'HTML',
520 523
  'HTML Templates'              => 'HTML-Vorlagen',
524
  'Header'                      => '?berschrift',
521 525
  'Heading'                     => '?berschrift',
522 526
  'Help'                        => 'Hilfe',
523 527
  'Here\'s an example command line:' => 'Hier ist eine Kommandozeile, die als Beispiel dient:',
......
629 633
  'Lieferantennummer'           => 'Lieferantennummer',
630 634
  'Lieferungen'                 => 'Lieferungen',
631 635
  'Line Total'                  => 'Zeilensumme',
632
  'Link'                        => 'Verkn?pfungen',
633 636
  'List Accounts'               => 'Konten anzeigen',
634 637
  'List Businesses'             => 'Kunden-/Lieferantentypen anzeigen',
635 638
  'List Departments'            => 'Abteilungen anzeigen',
......
656 659
  'Lx-Office is about to update the database <b><TMPL_VAR dbname ESCAPE=HTML></b>. You should create a backup of the database before proceeding because the backup might not be reversible.' => 'Lx-Office wird gleich die Datenbank <b><TMPL_VAR dbname ESCAPE=HTML></b> aktualisieren. Sie sollten eine Sicherungskopie der Datenbank erstellen, bevor Sie fortfahren, da die Aktualisierung unter Umst&auml;nden nicht umkehrbar ist.',
657 660
  'MAILED'                      => 'Gesendet',
658 661
  'Mahnungsnummer'              => 'Mahnungsnummer',
662
  'Main Preferences'            => 'Grundeinstellungen',
659 663
  'Make'                        => 'Hersteller',
660 664
  'Manager'                     => 'Manager',
661 665
  'Mandantennummer'             => 'Mandantennummer',
......
712 716
  'No.'                         => 'Position',
713 717
  'Non-taxable Purchases'       => 'Nicht zu versteuernde Eink?ufe',
714 718
  'Non-taxable Sales'           => 'Nicht zu versteuernde Verk?ufe',
719
  'None'                        => 'Kein',
715 720
  'Not Discountable'            => 'Nicht rabattierf?hig',
716 721
  'Not delivered'               => 'Nicht geliefert',
717 722
  'Not obsolete'                => 'G?ltig',
......
730 735
  'Obsolete'                    => 'Ung?ltig',
731 736
  'Oct'                         => 'Okt',
732 737
  'October'                     => 'Oktober',
738
  'Off'                         => 'Aus',
733 739
  'Old (on the side)'           => 'Alt (seitlich)',
734 740
  'On'                          => 'An',
735 741
  'On Hand'                     => 'Auf Lager',
......
810 816
  'Post Payment'                => 'Zahlung buchen',
811 817
  'Post as new'                 => 'Neu buchen',
812 818
  'Postscript'                  => 'Postscript',
819
  'Posustva_coa'                => 'USTVA Kennz.',
813 820
  'Preferences'                 => 'Benutzereinstellungen',
814 821
  'Preferences saved!'          => 'Einstellungen gespeichert!',
815 822
  'Preis'                       => 'Preis',
......
890 897
  'Removed spoolfiles!'         => 'Druckdateien entfernt!',
891 898
  'Removing marked entries from queue ...' => 'Markierte Eintr?ge werden von der Warteschlange entfernt ...',
892 899
  'Repeat the password'         => 'Passwort wiederholen',
900
  'Report Positions'            => 'Berichte',
901
  'Report and misc. Preferences' => 'Sonstige Einstellungen',
893 902
  'Report for'                  => 'Bericht f?r',
894 903
  'Reports'                     => 'Berichte',
895 904
  'Reqdate'                     => 'Lieferdatum',
......
911 920
  'Sat. Fax'                    => 'Sat. Fax',
912 921
  'Sat. Phone'                  => 'Sat. Tel.',
913 922
  'Save'                        => 'Speichern',
923
  'Save account first to insert taxkeys' => 'Einstellungen sind nach
924
  dem Speichern des Kontos verf?gbar...',
914 925
  'Save and AP Transaction'     => 'Speichern und Kreditorenbuchung erfassen',
915 926
  'Save and AR Transaction'     => 'Speichern und Debitorenbuchung erfassen',
916 927
  'Save and Close'              => 'Speichern und schlie?en',
......
971 982
  'Source'                      => 'Beleg',
972 983
  'Spoolfile'                   => 'Druckdatei',
973 984
  'Start Dunning Process'       => 'Mahnprozess starten',
974
  'Startdate'                   => 'G?ltig ab',
985
  'Startdate_coa'               => 'G?ltig ab',
975 986
  'Statement'                   => 'Sammelrechnung',
976 987
  'Statement Balance'           => 'Sammelrechnungsbilanz',
977 988
  'Statement sent to'           => 'Sammelrechnung verschickt an',
......
1006 1017
  'Tax collected'               => 'vereinnahmte Steuer',
1007 1018
  'Tax number'                  => 'Steuernummer',
1008 1019
  'Tax paid'                    => 'Vorsteuer',
1009
  'Taxaccount'                  => 'Steuer Konto',
1020
  'Tax-o-matic Account: '       => '',
1021
  'Taxaccount_coa'              => 'Automatikkonto',
1010 1022
  'Taxation'                    => 'Versteuerungs Verfahren',
1011
  'Taxdescription'              => 'Steuerkonto<br />Beschreibung',
1023
  'Taxdescription_coa'          => 'Steuer',
1012 1024
  'Taxkey'                      => 'Steuerschl?ssel',
1025
  'Taxkey_coa'                  => 'Steuerschl?ssel',
1026
  'Taxkeys and Taxreport Preferences' => 'Steuerautomatik und UStVA',
1027
  'Taxlink_coa'                 => 'Steuerautomatik',
1013 1028
  'Tel'                         => 'Tel',
1014 1029
  'Tel.'                        => 'Telefon',
1015 1030
  'Telephone'                   => 'Telefon',
......
1093 1108
  'USt-IdNr.'                   => 'USt-IdNr.',
1094 1109
  'UStVA'                       => 'UStVA',
1095 1110
  'UStVA (PDF-Dokument)'        => 'UStVa als PDF-Dokument',
1096
  'UStVA-Nr. 35'                => 'Kz. 35',
1097
  'UStVA-Nr. 36'                => 'Kz. 36',
1098
  'UStVA-Nr. 39'                => 'Kz. 37',
1099
  'UStVA-Nr. 41'                => 'Kz. 41',
1100
  'UStVA-Nr. 42'                => 'Kz. 42',
1101
  'UStVA-Nr. 43'                => 'Kz. 43',
1102
  'UStVA-Nr. 44'                => 'Kz. 44',
1103
  'UStVA-Nr. 45'                => 'Kz. 45',
1104
  'UStVA-Nr. 48'                => 'Kz. 48',
1105
  'UStVA-Nr. 49'                => 'Kz. 49',
1106
  'UStVA-Nr. 51 left'           => 'Kz. 51 links',
1107
  'UStVA-Nr. 51 right'          => 'Kz. 51 rechts',
1108
  'UStVA-Nr. 52'                => 'Kz. 52',
1109
  'UStVA-Nr. 53'                => 'Kz. 53',
1110
  'UStVA-Nr. 59'                => 'Kz. 59',
1111
  'UStVA-Nr. 60'                => 'Kz. 60',
1112
  'UStVA-Nr. 61'                => 'Kz. 61',
1113
  'UStVA-Nr. 62'                => 'Kz. 62',
1114
  'UStVA-Nr. 63'                => 'Kz. 63',
1115
  'UStVA-Nr. 64'                => 'Kz. 64',
1116
  'UStVA-Nr. 65'                => 'Kz. 65',
1117
  'UStVA-Nr. 66'                => 'Kz. 66',
1118
  'UStVA-Nr. 67'                => 'Kz. 67',
1119
  'UStVA-Nr. 69'                => 'Kz. 69',
1120
  'UStVA-Nr. 73'                => 'Kz. 73',
1121
  'UStVA-Nr. 74'                => 'Kz. 74',
1122
  'UStVA-Nr. 76'                => 'Kz. 76',
1123
  'UStVA-Nr. 77'                => 'Kz. 77',
... Dieser Diff wurde abgeschnitten, weil er die maximale Anzahl anzuzeigender Zeilen überschreitet.

Auch abrufbar als: Unified diff