Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 8c94b0ea

Von Philip Reetz vor mehr als 16 Jahren hinzugefügt

  • ID 8c94b0eaaf4e1b3717f36a755d71d848abcb21a5
  • Vorgänger a18cc3f5
  • Nachfolger cb8d5a5d

Ueberarbeiteter Kontenbericht

Unterschiede anzeigen:

bin/mozilla/ca.pl
142 142

  
143 143
  $form->{title} = $locale->text('List Transactions');
144 144
  $form->{title} .= " - " . $locale->text('Account') . " $form->{accno}";
145
  $year = (localtime)[5] + 1900;
145 146

  
146 147
  # get departments
147 148
  $form->all_departments(\%myconfig);
......
160 161
	  <td colspan=3><select name=department>$form->{selectdepartment}</select></td>
161 162
	</tr>
162 163
| if $form->{selectdepartment};
164
  $accrual = ($eur) ? ""        : "checked";
165
  $cash    = ($eur) ? "checked" : "";
166
 
167
  $name_1    = "fromdate";
168
  $id_1      = "fromdate";
169
  $value_1   = "$form->{fromdate}";
170
  $trigger_1 = "trigger1";
171
  $name_2    = "todate";
172
  $id_2      = "todate";
173
  $value_2   = "";
174
  $trigger_2 = "trigger2";
175

  
176

  
177
  # with JavaScript Calendar
178
  if ($form->{jsscript}) {
179
    if ($name_1 eq "") {
180

  
181
      $button1 = qq|
182
         <input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">|;
183
      $button1_2 = qq|
184
        <input type=button name=$name_2 id="$trigger_2" value=|
185
        . $locale->text('button') . qq|>|;
186

  
187
      #write Trigger
188
      $jsscript =
189
        Form->write_trigger(\%myconfig, "1", "$name_2", "BR", "$trigger_2");
190
    } else {
191
      $button1 = qq|
192
         <input name=$name_1 id=$id_1 size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\" value="$value_1">|;
193
      $button1_2 = qq|
194
        <input type=button name=$name_1 id="$trigger_1" value=|
195
        . $locale->text('button') . qq|>|;
196
      $button2 = qq|
197
         <input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">|;
198
      $button2_2 = qq|
199
         <input type=button name=$name_2 id="$trigger_2" value=|
200
        . $locale->text('button') . qq|>
201
       |;
202

  
203
      #write Trigger
204
      $jsscript =
205
        Form->write_trigger(\%myconfig, "2", "$name_1", "BR", "$trigger_1",
206
                            "$name_2", "BL", "$trigger_2");
207
    }
208
  } else {
209

  
210
    # without JavaScript Calendar
211
    if ($name_1 eq "") {
212
      $button1 =
213
        qq|<input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">|;
214
    } else {
215
      $button1 =
216
        qq|<input name=$name_1 id=$id_1 size=11 title="$myconfig{dateformat}" value="$value_1" onBlur=\"check_right_date_format(this)\">|;
217
      $button2 =
218
        qq|<input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">|;
219
    }
220
  }
221
  $form->{javascript} .= qq|<script type="text/javascript" src="js/common.js"></script>|;
222
  $form->header;
223
  $onload = qq|focus()|;
224
  $onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|;
225
  $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|;
226

  
163 227

  
164 228
  $form->header;
165 229

  
166 230
  $form->{description} =~ s/\"/&quot;/g;
167 231

  
168 232
  print qq|
169
<body>
233
<body onLoad="$onload">
170 234

  
171 235
<form method=post action=$form->{script}>
172 236

  
......
177 241
<input type=hidden name=accounttype value=$form->{accounttype}>
178 242

  
179 243
<table border=0 width=100%>
180
  <tr><th class=listtop>$form->{title}</th></tr>
181
  <tr height="5"></tr
182
  <tr valign=top>
183
    <td>
184
      <table>
185
        $department
244
  <tr>
245
    <th class=listtop>$form->{title}</th>
246
  </tr>
247

  
248
</table>
249
<table>
186 250
	<tr>
187
	  <th align=right>| . $locale->text('From') . qq|</th>
188
	  <td><input name=fromdate size=11 title="$myconfig{dateformat}"></td>
189
	  <th align=right>| . $locale->text('To') . qq|</th>
190
	  <td><input name=todate size=11 title="$myconfig{dateformat}"></td>
251
	  <th align=left><input name=reporttype class=radio type=radio value="custom" checked> |
252
      . $locale->text('Customized Report') . qq|</th>
191 253
	</tr>
192 254
	<tr>
193
	  <th align=right>| . $locale->text('Include in Report') . qq|</th>
194
	  <td colspan=3>
195
	  <input name=l_subtotal class=checkbox type=checkbox value=Y>&nbsp;|
196
    . $locale->text('Subtotal') . qq|</td>
255
	  <th colspan=1>| . $locale->text('Year') . qq|</th>
256
	  <td><input name=year size=11 title="|
257
      . $locale->text('YYYY') . qq|" value="$year"></td>
197 258
	</tr>
198
      </table>
199
    </td>
200
  </tr>
201
  <tr><td><hr size=3 noshade></td></tr>
259
|;
260

  
261
    print qq|
262
	<tr>
263
		<td align=right>
264
<b> | . $locale->text('Yearly') . qq|</b> </td>
265
		<th align=left>| . $locale->text('Quarterly') . qq|</th>
266
		<th align=left colspan=3>| . $locale->text('Monthly') . qq|</th>
267
	</tr>
268
	<tr>
269
		<td align=right>&nbsp; <input name=duetyp class=radio type=radio value="13"
270
$checked></td>
271
		<td><input name=duetyp class=radio type=radio value="A" $checked >&nbsp;1. |
272
      . $locale->text('Quarter') . qq|</td>
273
|;
274
    $checked = "checked";
275
    print qq|
276
		<td><input name=duetyp class=radio type=radio value="1" $checked >&nbsp;|
277
      . $locale->text('January') . qq|</td>
278
|;
279
    $checked = "";
280
    print qq|
281
		<td><input name=duetyp class=radio type=radio value="5" $checked >&nbsp;|
282
      . $locale->text('May') . qq|</td>
283
		<td><input name=duetyp class=radio type=radio value="9" $checked >&nbsp;|
284
      . $locale->text('September') . qq|</td>
285

  
286
	</tr>
287
	<tr>
288
		<td align= right>&nbsp;</td>
289
		<td><input name=duetyp class=radio type=radio value="B" $checked>&nbsp;2. |
290
      . $locale->text('Quarter') . qq|</td>
291
		<td><input name=duetyp class=radio type=radio value="2" $checked >&nbsp;|
292
      . $locale->text('February') . qq|</td>
293
		<td><input name=duetyp class=radio type=radio value="6" $checked >&nbsp;|
294
      . $locale->text('June') . qq|</td>
295
		<td><input name=duetyp class=radio type=radio value="10" $checked >&nbsp;|
296
      . $locale->text('October') . qq|</td>
297
	</tr>
298
	<tr>
299
		<td> &nbsp;</td>
300
		<td><input name=duetyp class=radio type=radio value="C" $checked>&nbsp;3. |
301
      . $locale->text('Quarter') . qq|</td>
302
		<td><input name=duetyp class=radio type=radio value="3" $checked >&nbsp;|
303
      . $locale->text('March') . qq|</td>
304
		<td><input name=duetyp class=radio type=radio value="7" $checked >&nbsp;|
305
      . $locale->text('July') . qq|</td>
306
		<td><input name=duetyp class=radio type=radio value="11" $checked >&nbsp;|
307
      . $locale->text('November') . qq|</td>
308

  
309
	</tr>
310
	<tr>
311
		<td> &nbsp;</td>
312
		<td><input name=duetyp class=radio type=radio value="D" $checked>&nbsp;4. |
313
      . $locale->text('Quarter') . qq|&nbsp;</td>
314
		<td><input name=duetyp class=radio type=radio value="4" $checked >&nbsp;|
315
      . $locale->text('April') . qq|</td>
316
		<td><input name=duetyp class=radio type=radio value="8" $checked >&nbsp;|
317
      . $locale->text('August') . qq|</td>
318
		<td><input name=duetyp class=radio type=radio value="12" $checked >&nbsp;|
319
      . $locale->text('December') . qq|</td>
320

  
321
	</tr>
322
	<tr>
323
   		<td colspan=5><hr size=3 noshade></td>
324
	</tr>
325
	<tr>
326
          <th align=left><input name=reporttype class=radio type=radio value="free" $checked> |
327
      . $locale->text('Free report period') . qq|</th>
328
	  <td align=left colspan=4>| . $locale->text('From') . qq|&nbsp;
329
	      $button1
330
              $button1_2&nbsp;
331
	      | . $locale->text('Bis') . qq|&nbsp;
332
	      $button2
333
              $button2_2
334
          </td>
335
        </tr>
336
	<tr>
337
   		<td colspan=5><hr size=3 noshade></td>
338
	</tr>
339
	<tr>
340
	  <th align=leftt>| . $locale->text('Method') . qq|</th>
341
	  <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
342
      . $locale->text('Accrual') . qq|
343
	  &nbsp;<input name=method class=radio type=radio value=cash $cash>|
344
      . $locale->text('EUR') . qq|</td>
345
	</tr>
346
        <tr>
347
         <th align=right colspan=4>|
348
      . $locale->text('Decimalplaces')
349
      . qq|</th>
350
             <td><input name=decimalplaces size=3 value="2"></td>
351
         </tr>
352
                                    
353
$jsscript
354
  <tr><td colspan=5 ><hr size=3 noshade></td></tr>
202 355
</table>
203 356

  
204 357
<br><input class=submit type=submit name=action value="|
......
219 372

  
220 373
  $form->{title} = $locale->text('Account') . " $form->{accno} - $form->{description}";
221 374

  
375
  if ($form->{reporttype} eq "custom") {
376

  
377
    #forgotten the year --> thisyear
378
    if ($form->{year} !~ m/^\d\d\d\d$/) {
379
      $locale->date(\%myconfig, $form->current_date(\%myconfig), 0) =~
380
        /(\d\d\d\d)/;
381
      $form->{year} = $1;
382
    }
383

  
384
    #yearly report
385
    if ($form->{duetyp} eq "13") {
386
      $form->{fromdate} = "1.1.$form->{year}";
387
      $form->{todate}   = "31.12.$form->{year}";
388
    }
389

  
390
    #Quater reports
391
    if ($form->{duetyp} eq "A") {
392
      $form->{fromdate} = "1.1.$form->{year}";
393
      $form->{todate}   = "31.3.$form->{year}";
394
    }
395
    if ($form->{duetyp} eq "B") {
396
      $form->{fromdate} = "1.4.$form->{year}";
397
      $form->{todate}   = "30.6.$form->{year}";
398
    }
399
    if ($form->{duetyp} eq "C") {
400
      $form->{fromdate} = "1.7.$form->{year}";
401
      $form->{todate}   = "30.9.$form->{year}";
402
    }
403
    if ($form->{duetyp} eq "D") {
404
      $form->{fromdate} = "1.10.$form->{year}";
405
      $form->{todate}   = "31.12.$form->{year}";
406
    }
407

  
408
    #Monthly reports
409
  SWITCH: {
410
      $form->{duetyp} eq "1" && do {
411
        $form->{fromdate} = "1.1.$form->{year}";
412
        $form->{todate}   = "31.1.$form->{year}";
413
        last SWITCH;
414
      };
415
      $form->{duetyp} eq "2" && do {
416
        $form->{fromdate} = "1.2.$form->{year}";
417

  
418
        #this works from 1901 to 2099, 1900 and 2100 fail.
419
        $leap = ($form->{year} % 4 == 0) ? "29" : "28";
420
        $form->{todate} = "$leap.2.$form->{year}";
421
        last SWITCH;
422
      };
423
      $form->{duetyp} eq "3" && do {
424
        $form->{fromdate} = "1.3.$form->{year}";
425
        $form->{todate}   = "31.3.$form->{year}";
426
        last SWITCH;
427
      };
428
      $form->{duetyp} eq "4" && do {
429
        $form->{fromdate} = "1.4.$form->{year}";
430
        $form->{todate}   = "30.4.$form->{year}";
431
        last SWITCH;
432
      };
433
      $form->{duetyp} eq "5" && do {
434
        $form->{fromdate} = "1.5.$form->{year}";
435
        $form->{todate}   = "31.5.$form->{year}";
436
        last SWITCH;
437
      };
438
      $form->{duetyp} eq "6" && do {
439
        $form->{fromdate} = "1.6.$form->{year}";
440
        $form->{todate}   = "30.6.$form->{year}";
441
        last SWITCH;
442
      };
443
      $form->{duetyp} eq "7" && do {
444
        $form->{fromdate} = "1.7.$form->{year}";
445
        $form->{todate}   = "31.7.$form->{year}";
446
        last SWITCH;
447
      };
448
      $form->{duetyp} eq "8" && do {
449
        $form->{fromdate} = "1.8.$form->{year}";
450
        $form->{todate}   = "31.8.$form->{year}";
451
        last SWITCH;
452
      };
453
      $form->{duetyp} eq "9" && do {
454
        $form->{fromdate} = "1.9.$form->{year}";
455
        $form->{todate}   = "30.9.$form->{year}";
456
        last SWITCH;
457
      };
458
      $form->{duetyp} eq "10" && do {
459
        $form->{fromdate} = "1.10.$form->{year}";
460
        $form->{todate}   = "31.10.$form->{year}";
461
        last SWITCH;
462
      };
463
      $form->{duetyp} eq "11" && do {
464
        $form->{fromdate} = "1.11.$form->{year}";
465
        $form->{todate}   = "30.11.$form->{year}";
466
        last SWITCH;
467
      };
468
      $form->{duetyp} eq "12" && do {
469
        $form->{fromdate} = "1.12.$form->{year}";
470
        $form->{todate}   = "31.12.$form->{year}";
471
        last SWITCH;
472
      };
473
    }
474
  }
475

  
222 476
  CA->all_transactions(\%myconfig, \%$form);
223 477

  
478
  print(STDERR "EB: $form->{beginning_balance}\n");
479

  
480
  my $saldo_old = ($form->{saldo_old} > 0) ? $form->format_amount(\%myconfig, $form->{saldo_old}, 2) . " H" : $form->format_amount(\%myconfig, abs($form->{saldo_old}) , 2) . " S";
481

  
482
  my $eb_string = ($form->{beginning_balance} > 0) ? $form->format_amount(\%myconfig, $form->{beginning_balance}, 2) . " H" : $form->format_amount(\%myconfig, abs($form->{beginning_balance}), 2) . " S";
483
  print(STDERR "EB: $eb_string\n");
484

  
224 485
  my @options;
225 486
  if ($form->{department}) {
226 487
    my ($department) = split /--/, $form->{department};
......
249 510

  
250 511
  push @options, $period;
251 512

  
252
  my @columns     = qw(transdate reference description debit credit balance);
513
  my @columns     = qw(transdate reference description gegenkonto debit credit ustkonto ustrate);
253 514
  my %column_defs = (
254 515
    'transdate'   => { 'text' => $locale->text('Date'), },
255 516
    'reference'   => { 'text' => $locale->text('Reference'), },
256 517
    'description' => { 'text' => $locale->text('Description'), },
257 518
    'debit'       => { 'text' => $locale->text('Debit'), },
258 519
    'credit'      => { 'text' => $locale->text('Credit'), },
259
    'balance'     => { 'text' => $locale->text('Balance'), },
260
  );
261
  my %column_alignment = map { $_ => 'right' } qw(debit credit balance);
520
    'gegenkonto'     => { 'text' => $locale->text('Gegenkonto'), },
521
    'ustkonto'     => { 'text' => $locale->text('USt-Konto'), },
522
     'ustrate'     => { 'text' => $locale->text('Satz %'), },
523
 );
524
  my %column_alignment = map { $_ => 'right' } qw(debit credit);
525

  
526
  @custom_headers = ();
527
 # Zeile 1:
528
 push @custom_headers, [
529
   { 'text' => 'Letzte Buchung', },
530
   { 'text' => 'EB-Wert', },
531
   { 'text' => 'Saldo alt', 'colspan' => 2, },
532
   { 'text' => 'Jahresverkehrszahlen alt', 'colspan' => 2, },
533
   { 'text' => '', 'colspan' => 2, },
534
 ];
535
 push @custom_headers, [
536
   { 'text' => $form->{last_transaction}, },
537
   { 'text' => $eb_string, },
538
   { 'text' => $saldo_old, 'colspan' => 2, },
539
   { 'text' => $form->format_amount(\%myconfig, abs($form->{old_balance_debit}), 2) . " S", },
540
   { 'text' => $form->format_amount(\%myconfig, $form->{old_balance_credit}, 2) . " H", },
541
   { 'text' => '', 'colspan' => 2, },
542
 ];
543
 # Zeile 2:
544
 push @custom_headers, [
545
   { 'text' => $locale->text('Date'), },
546
   { 'text' => $locale->text('Reference'), },
547
   { 'text' => $locale->text('Description'), },
548
   { 'text' => $locale->text('Gegenkonto'), },
549
   { 'text' => $locale->text('Debit'), },
550
   { 'text' => $locale->text('Credit'), },
551
   { 'text' => $locale->text('USt-Konto'), },
552
   { 'text' => $locale->text('Satz %'), },
553
 ];
554

  
555

  
262 556

  
263 557
  my @hidden_variables = qw(accno fromdate todate description accounttype l_heading l_subtotal department projectnumber project_id sort);
264 558

  
......
268 562
  $form->{callback} = $link . '&sort=' . E($form->{sort});
269 563

  
270 564
  my $report = SL::ReportGenerator->new(\%myconfig, $form);
565
  $report->set_custom_headers(@custom_headers);
271 566

  
272 567
  $report->set_options('top_info_text'         => join("\n", @options),
273 568
                       'output_format'         => 'HTML',
......
288 583

  
289 584
  my $ml = ($form->{category} =~ /(A|E)/) ? -1 : 1;
290 585

  
291
  if ($form->{accno} && $form->{balance}) {
292
    my $row = {
293
      'balance' => {
294
        'data'  => $form->format_amount(\%myconfig, $form->{balance} * $ml, 2),
295
        'align' => 'right',
296
      },
297
    };
298

  
299
    $report->add_data($row);
300
  }
301 586

  
302 587
  my $idx       = 0;
303 588
  my %totals    = ( 'debit' => 0, 'credit' => 0 );
......
305 590
  my ($previous_index, $row_set);
306 591

  
307 592
  foreach my $ca (@{ $form->{CA} }) {
308
    $form->{balance} += $ca->{amount};
309 593

  
310 594
    foreach (qw(debit credit)) {
311 595
      $subtotals{$_} += $ca->{$_};
......
313 597
      $ca->{$_}       = $form->format_amount(\%myconfig, $ca->{$_}, 2) if ($ca->{$_} != 0);
314 598
    }
315 599

  
316
    $ca->{balance} = $form->format_amount(\%myconfig, $form->{balance} * $ml, 2);
317 600

  
318 601
    my $row = { };
319 602

  
603
    $ca->{ustrate} = $form->format_amount(\%myconfig, $ca->{ustrate} * 100, 2) if ($ca->{ustrate} != 0);
604

  
605
    
606

  
607
    foreach my $gegenkonto (@{ $ca->{GEGENKONTO} }) {
608
      if ($ca->{gegenkonto} eq "") {
609
        $ca->{gegenkonto} = $gegenkonto->{accno};
610
      } else {
611
        $ca->{gegenkonto} .= ", " . $gegenkonto->{accno};
612
      }
613
    }
614

  
320 615
    foreach (@columns) {
321 616
      $row->{$_} = {
322 617
        'data'  => $ca->{$_},
......
356 651
  $row->{balance}->{data} = $form->format_amount(\%myconfig, $form->{balance} * $ml, 2);
357 652
  $report->add_data($row);
358 653

  
654

  
655
  $report->add_separator();
656
  my $row = {
657
     'transdate' => {
658
       'data'    => "",
659
       'class' => 'listtotal',
660
     },
661
     'reference' => {
662
       'data'    => $locale->text('EB-Wert'),
663
       'class' => 'listtotal',
664
     },
665
     'description'      => {
666
       'data'    => $locale->text('Saldo neu'),
667
       'colspan' => 2,
668
       'class' => 'listtotal',
669
     },
670
     'debit'      => {
671
       'data'    => $locale->text('Jahresverkehrszahlen neu'),
672
       'colspan' => 2,
673
       'align' => 'left',
674
       'class' => 'listtotal',
675
    },
676
     'ustkonto'      => {
677
       'data'    => '',
678
       'colspan' => 2,
679
       'align' => 'left',
680
       'class' => 'listtotal',
681
    },
682
  };
683

  
684
  $report->add_data($row);
685
  my $saldo_new = ($form->{saldo_new} > 0) ? $form->format_amount(\%myconfig, $form->{saldo_new}, 2) . " H" : $form->format_amount(\%myconfig, abs($form->{saldo_new}) , 2) . " S";
686
  my $row = {
687
     'transdate' => {
688
       'data'    => "",
689
       'class' => 'listtotal',
690
     },
691
     'reference' => {
692
       'data'    => $eb_string,
693
       'class' => 'listtotal',
694
     },
695
     'description'      => {
696
       'data'    => $saldo_new,
697
       'colspan' => 2,
698
       'class' => 'listtotal',
699
     },
700
     'debit'      => {
701
       'data'    => $form->format_amount(\%myconfig, abs($form->{current_balance_debit}) , 2) . " S",
702
       'class' => 'listtotal',
703
     },
704
      'credit'      => {
705
       'data'    => $form->format_amount(\%myconfig, $form->{current_balance_credit}, 2) . " H",
706
       'class' => 'listtotal',
707
     },
708
      'ustkonto'      => {
709
       'data'    => "",
710
       'colspan' => 2,
711
       'class' => 'listtotal',
712
     },
713
  };
714

  
715
  $report->add_data($row);
716

  
359 717
  $report->generate_with_headers();
360 718

  
361 719
  $lxdebug->leave_sub();

Auch abrufbar als: Unified diff