Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision c7581445

Von Moritz Bunkus vor mehr als 17 Jahren hinzugefügt

  • ID c7581445ed0a428842ae3e74ab0542cb9c0d3932
  • Vorgänger 971ca389
  • Nachfolger 796b3881

Umstellung der Liste der Zahlungsein- und -ausgänge auf die Verwendung von ReportGenerator.

Unterschiede anzeigen:

bin/mozilla/rp.pl
2252 2252

  
2253 2253
  RP->payments(\%myconfig, \%$form);
2254 2254

  
2255
  @columns =
2256
    $form->sort_columns(qw(transdate reference name paid source memo));
2257

  
2258
  # construct href
2259
  $account    = $form->escape($form->{account});
2260
  $title      = $form->escape($form->{title});
2261
  $department = $form->escape($form->{department});
2262
  $form->{paymentaccounts} =~ s/ /%20/g;
2263
  $reference = $form->escape($form->{reference});
2264
  $source    = $form->escape($form->{source});
2265
  $memo      = $form->escape($form->{memo});
2255
  my @hidden_variables = qw(account title department reference source memo fromdate todate
2256
                            fx_transaction db prepayment paymentaccounts sort);
2266 2257

  
2267
  $href =
2268
    "$form->{script}?action=list_payments&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&fx_transaction=$form->{fx_transaction}&db=$form->{db}&prepayment=$form->{prepayment}&title=$title&account=$account&department=$department&paymentaccounts=$form->{paymentaccounts}&reference=$reference&source=$source&memo=$memo";
2258
  my $href = build_std_url('action=list_payments', grep { $form->{$_} } @hidden_variables);
2259
  $form->{callback} = $href;
2269 2260

  
2270
  # construct callback
2271
  $account    = $form->escape($form->{account},    1);
2272
  $title      = $form->escape($form->{title},      1);
2273
  $department = $form->escape($form->{department}, 1);
2274
  $reference  = $form->escape($form->{reference},  1);
2275
  $source     = $form->escape($form->{source},     1);
2276
  $memo       = $form->escape($form->{memo},       1);
2277

  
2278
  $form->{callback} =
2279
    "$form->{script}?action=list_payments&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&fx_transaction=$form->{fx_transaction}&db=$form->{db}&prepayment=$form->{prepayment}&title=$title&account=$account&department=$department&paymentaccounts=$form->{paymentaccounts}&reference=$reference&source=$source&memo=$memo&sort=$form->{sort}";
2280
  $callback = $form->escape($form->{callback});
2261
  my @columns     = qw(transdate invnumber name paid source memo);
2262
  my %column_defs = (
2263
    'name'      => { 'text' => $locale->text('Description'), },
2264
    'invnumber' => { 'text' => $locale->text('Reference'), },
2265
    'transdate' => { 'text' => $locale->text('Date'), },
2266
    'paid'      => { 'text' => $locale->text('Amount'), },
2267
    'source'    => { 'text' => $locale->text('Source'), },
2268
    'memo'      => { 'text' => $locale->text('Memo'), },
2269
  );
2270
  my %column_alignment = ('paid' => 'right');
2281 2271

  
2282
  $column_header{name} =
2283
      "<th><a class=listheading href=$href&sort=name>"
2284
    . $locale->text('Description')
2285
    . "</a></th>";
2286
  $column_header{reference} =
2287
      "<th><a class=listheading href=$href&sort=invnumber>"
2288
    . $locale->text('Reference')
2289
    . "</a></th>";
2290
  $column_header{transdate} =
2291
      "<th><a class=listheading href=$href&sort=transdate>"
2292
    . $locale->text('Date')
2293
    . "</a></th>";
2294
  $column_header{paid} =
2295
    "<th class=listheading>" . $locale->text('Amount') . "</a></th>";
2296
  $column_header{source} =
2297
      "<th><a class=listheading href=$href&sort=source>"
2298
    . $locale->text('Source')
2299
    . "</a></th>";
2300
  $column_header{memo} =
2301
      "<th><a class=listheading href=$href&sort=memo>"
2302
    . $locale->text('Memo')
2303
    . "</a></th>";
2272
  map { $column_defs{$_}->{link} = $href . "&sort=$_" } grep { $_ ne 'paid' } @columns;
2304 2273

  
2274
  my @options;
2305 2275
  if ($form->{fromdate}) {
2306
    $option .= "\n<br>" if ($option);
2307
    $option .=
2308
        $locale->text('From') . "&nbsp;"
2309
      . $locale->date(\%myconfig, $form->{fromdate}, 1);
2276
    push @options, $locale->text('From') . "&nbsp;" . $locale->date(\%myconfig, $form->{fromdate}, 1);
2310 2277
  }
2311 2278
  if ($form->{todate}) {
2312
    $option .= "\n<br>" if ($option);
2313
    $option .=
2314
        $locale->text('bis') . "&nbsp;"
2315
      . $locale->date(\%myconfig, $form->{todate}, 1);
2279
    push @options, $locale->text('bis') . "&nbsp;" . $locale->date(\%myconfig, $form->{todate}, 1);
2316 2280
  }
2317 2281

  
2318
  @column_index = @columns;
2319
  $colspan      = $#column_index + 1;
2282
  my $report = SL::ReportGenerator->new(\%myconfig, $form);
2320 2283

  
2321
  $form->header;
2284
  my $attachment_basename = $form->{db} eq 'ar' ? $locale->text('list_of_receipts') : $locale->text('list_of_payments');
2322 2285

  
2323
  print qq|
2324
<body>
2286
  $report->set_options('top_info_text'         => join("\n", @options),
2287
                       'output_format'         => 'HTML',
2288
                       'title'                 => $form->{title},
2289
                       'attachment_basename'   => $attachment_basename . strftime('_%Y%m%d', localtime time),
2290
                       'std_column_visibility' => 1,
2291
    );
2292
  $report->set_options_from_form();
2325 2293

  
2326
<table width=100%>
2327
  <tr>
2328
    <th class=listtop>$form->{title}</th>
2329
  </tr>
2330
  <tr height="5"></tr>
2331
  <tr>
2332
    <td>$option</td>
2333
  </tr>
2334
  <tr>
2335
    <td>
2336
      <table width=100%>
2337
	<tr class=listheading>
2338
|;
2294
  $report->set_columns(%column_defs);
2295
  $report->set_column_order(@columns);
2339 2296

  
2340
  map { print "\n$column_header{$_}" } @column_index;
2297
  $report->set_export_options('list_payments', @hidden_variables);
2341 2298

  
2342
  print qq|
2343
        </tr>
2344
|;
2299
  $report->set_sort_indicator($form->{sort}, 1);
2345 2300

  
2346
  foreach $ref (sort { $a->{accno} cmp $b->{accno} } @{ $form->{PR} }) {
2301
  my $total_paid    = 0;
2347 2302

  
2303
  foreach my $ref (sort { $a->{accno} cmp $b->{accno} } @{ $form->{PR} }) {
2348 2304
    next unless @{ $form->{ $ref->{id} } };
2349 2305

  
2350
    print qq|
2351
        <tr>
2352
	  <th colspan=$colspan align=left>$ref->{accno}--$ref->{description}</th>
2353
	</tr>
2354
|;
2306
    $report->add_control({ 'type' => 'colspan_data', 'data' => "$ref->{accno}--$ref->{description}" });
2355 2307

  
2356
    foreach $payment (@{ $form->{ $ref->{id} } }) {
2308
    my $subtotal_paid = 0;
2357 2309

  
2358
      $module = $payment->{module};
2310
    foreach my $payment (@{ $form->{ $ref->{id} } }) {
2311
      my $module = $payment->{module};
2359 2312
      $module = 'is' if ($payment->{invoice} && $payment->{module} eq 'ar');
2360 2313
      $module = 'ir' if ($payment->{invoice} && $payment->{module} eq 'ap');
2361 2314

  
2362
      $href =
2363
        qq|${module}.pl?action=edit&id=$payment->{id}&login=$form->{login}&password=$form->{password}&callback=$callback|;
2315
      my $link = build_std_url("module=${module}.pl", 'action=edit', 'id=' . E($payment->{id}), 'callback');
2364 2316

  
2365
      $column_data{name}      = "<td>$payment->{name}&nbsp;</td>";
2366
      $column_data{reference} =
2367
        qq|<td><a href=$href>$payment->{invnumber}</a></td>|;
2368
      $column_data{transdate} = "<td>$payment->{transdate}&nbsp;</td>";
2369
      $column_data{paid}      =
2370
          "<td align=right>"
2371
        . $form->format_amount(\%myconfig, $payment->{paid}, 2, "&nbsp;")
2372
        . "</td>";
2373
      $column_data{source} = "<td>$payment->{source}&nbsp;</td>";
2374
      $column_data{memo}   = "<td>$payment->{memo}&nbsp;</td>";
2317
      $subtotal_paid += $payment->{paid};
2318
      $total_paid    += $payment->{paid};
2375 2319

  
2376
      $subtotalpaid += $payment->{paid};
2377
      $totalpaid    += $payment->{paid};
2320
      $payment->{paid} = $form->format_amount(\%myconfig, $payment->{paid}, 2);
2378 2321

  
2379
      $i++;
2380
      $i %= 2;
2381
      print qq|
2382
	<tr class=listrow$i>
2383
|;
2384

  
2385
      map { print "\n$column_data{$_}" } @column_index;
2322
      my $row = { };
2386 2323

  
2387
      print qq|
2388
        </tr>
2389
|;
2324
      foreach my $column (@columns) {
2325
        $row->{$column} = {
2326
          'data'  => $payment->{$column},
2327
          'align' => $column_alignment{$column},
2328
        };
2329
      }
2390 2330

  
2331
      $report->add_data($row);
2391 2332
    }
2392 2333

  
2393
    # print subtotals
2394
    map { $column_data{$_} = "<td>&nbsp;</td>" } @column_index;
2395

  
2396
    $column_data{paid} =
2397
      "<th class=listsubtotal align=right>"
2398
      . $form->format_amount(\%myconfig, $subtotalpaid, 2, "&nbsp;") . "</th>";
2399

  
2400
    print qq|
2401
	<tr class=listsubtotal>
2402
|;
2403

  
2404
    map { print "\n$column_data{$_}" } @column_index;
2405

  
2406
    print qq|
2407
        </tr>
2408
|;
2409

  
2410
    $subtotalpaid = 0;
2334
    my $row = { map { $_ => { 'class' => 'listsubtotal' } } @columns };
2335
    $row->{paid} = {
2336
      'data'  => $form->format_amount(\%myconfig, $subtotal_paid, 2),
2337
      'align' => 'right',
2338
      'class' => 'listsubtotal',
2339
    };
2411 2340

  
2341
    $report->add_data($row);
2412 2342
  }
2413 2343

  
2414
  # print total
2415
  map { $column_data{$_} = "<td>&nbsp;</td>" } @column_index;
2416

  
2417
  $column_data{paid} =
2418
    "<th class=listtotal align=right>"
2419
    . $form->format_amount(\%myconfig, $totalpaid, 2, "&nbsp;") . "</th>";
2344
  $report->add_separator();
2420 2345

  
2421
  print qq|
2422
        <tr class=listtotal>
2423
|;
2346
  my $row = { map { $_ => { 'class' => 'listtotal' } } @columns };
2347
  $row->{paid} = {
2348
    'data'  => $form->format_amount(\%myconfig, $total_paid, 2),
2349
    'align' => 'right',
2350
    'class' => 'listtotal',
2351
  };
2424 2352

  
2425
  map { print "\n$column_data{$_}" } @column_index;
2353
  $report->add_data($row);
2426 2354

  
2427
  print qq|
2428
        </tr>
2429

  
2430
      </table>
2431
    </td>
2432
  </tr>
2433
  <tr>
2434
    <td><hr size=3 noshade></td>
2435
  </tr>
2436
</table>
2437

  
2438
</body>
2439
</html>
2440
|;
2355
  $report->generate_with_headers();
2441 2356

  
2442 2357
  $lxdebug->leave_sub();
2443 2358
}
locale/de/all
1296 1296
  'lead deleted!'               => 'Kundenquelle gel?scht',
1297 1297
  'lead saved!'                 => 'Kundenquelle geichert',
1298 1298
  'list'                        => 'auflisten',
1299
  'list_of_payments'            => 'zahlungsausgaenge',
1300
  'list_of_receipts'            => 'zahlungseingaenge',
1299 1301
  'localhost'                   => 'lokaler Rechner',
1300 1302
  'logout'                      => 'abmelden',
1301 1303
  'mark as paid'                => 'als bezahlt markieren',
locale/de/rp
187 187
  'debug'                       => 'Debug',
188 188
  'for Period'                  => 'f?r den Zeitraum',
189 189
  'invoice'                     => 'Rechnung',
190
  'list_of_payments'            => 'zahlungsausgaenge',
191
  'list_of_receipts'            => 'zahlungseingaenge',
190 192
  'no'                          => 'nein',
191 193
  'packing_list'                => 'Versandliste',
192 194
  'pick_list'                   => 'Entnahmeliste',

Auch abrufbar als: Unified diff