Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision b3673e83

Von Moritz Bunkus vor mehr als 17 Jahren hinzugefügt

  • ID b3673e83306a36c0582a08ea9eada300fe3987aa
  • Vorgänger 7fcb078f
  • Nachfolger 0925bc9f

Kunden- und Liferantenstammdatenliste auf die Verwendung von ReportGenerator umgestellt.

Unterschiede anzeigen:

SL/CT.pm
587 587
  $sortorder =
588 588
    $form->{sort} && $allowed_sort_columns{$form->{sort}} ?
589 589
    $form->{sort} : "name";
590
  $form->{sort} = $sortorder;
590 591
  $sortorder = "country,city,street" if ($sortorder eq "address");
591 592

  
592 593
  if ($form->{"${cv}number"}) {
bin/mozilla/ct.pl
37 37
# $locale->text('Add Customer')
38 38
# $locale->text('Add Vendor')
39 39

  
40
use SL::CT;
41
use CGI::Ajax;
42 40
use CGI;
43
use Data::Dumper;
41
use CGI::Ajax;
42
use POSIX qw(strftime);
43

  
44
use SL::CT;
45
use SL::ReportGenerator;
44 46

  
45 47
require "bin/mozilla/common.pl";
48
require "bin/mozilla/reportgenerator.pl";
46 49

  
47 50
1;
48 51

  
......
217 220
sub list_names {
218 221
  $lxdebug->enter_sub();
219 222

  
220
  CT->search(\%myconfig, \%$form);
223
  $form->{IS_CUSTOMER} = $form->{db} eq 'customer';
221 224

  
222
  $callback =
223
    "$form->{script}?action=list_names&db=$form->{db}&login=$form->{login}&password=$form->{password}&status=$form->{status}&obsolete=$form->{obsolete}";
224
  $href = $callback;
225

  
226
  @columns =
227
    $form->sort_columns(id, name,
228
                        "$form->{db}number", address,
229
                        contact,             phone,
230
                        fax,                 email,
231
                        taxnumber,
232
                        sic_code,            business,
233
                        invnumber,           ordnumber,
234
                        quonumber);
235

  
236
  foreach $item (@columns) {
237
    if ($form->{"l_$item"} eq "Y") {
238
      push @column_index, $item;
239

  
240
      # add column to href and callback
241
      $callback .= "&l_$item=Y";
242
      $href     .= "&l_$item=Y";
243
    }
244
  }
245
  $number =
246
    ($form->{db} eq "customer")
247
    ? $locale->text('Customer Number')
248
    : $locale->text('Vendor Number');
225
  CT->search(\%myconfig, \%$form);
249 226

  
227
  my @options;
250 228
  if ($form->{status} eq 'all') {
251
    $option = $locale->text('All');
252
  }
253
  if ($form->{status} eq 'orphaned') {
254
    $option .= $locale->text('Orphaned');
229
    push @options, $locale->text('All');
230

  
231
  } elsif ($form->{status} eq 'orphaned') {
232
    push @options, $locale->text('Orphaned');
255 233
  }
234

  
256 235
  if ($form->{name}) {
257
    $callback .= "&name=" . $form->escape($form->{name}, 1);
258
    $href .= "&name=" . $form->escape($form->{name});
259
    $option .= "\n<br>" . $locale->text('Name') . " : $form->{name}";
236
    push @options, $locale->text('Name') . " : $form->{name}";
260 237
  }
261 238
  if ($form->{contact}) {
262
    $callback .= "&contact=" . $form->escape($form->{contact}, 1);
263
    $href .= "&contact=" . $form->escape($form->{contact});
264
    $option .= "\n<br>" . $locale->text('Contact') . " : $form->{contact}";
239
    push @options, $locale->text('Contact') . " : $form->{contact}";
265 240
  }
266 241
  if ($form->{"$form->{db}number"}) {
267
    $callback .=
268
      qq|&$form->{db}number=| . $form->escape($form->{"$form->{db}number"}, 1);
269
    $href .=
270
      "&$form->{db}number=" . $form->escape($form->{"$form->{db}number"});
271
    $option .=
272
      "\n<br>" . $locale->text('Number') . qq| : $form->{"$form->{db}number"}|;
242
    push @options, $locale->text('Number') . qq| : $form->{"$form->{db}number"}|;
273 243
  }
274 244
  if ($form->{email}) {
275
    $callback .= "&email=" . $form->escape($form->{email}, 1);
276
    $href .= "&email=" . $form->escape($form->{email});
277
    $option .= "\n<br>" . $locale->text('E-mail') . " : $form->{email}";
245
    push @options, $locale->text('E-mail') . " : $form->{email}";
278 246
  }
279 247

  
280
  $form->{callback} = "$callback&sort=$form->{sort}";
281
  $callback = $form->escape($form->{callback});
282

  
283
  $column_header{id} =
284
    qq|<th class=listheading>| . $locale->text('ID') . qq|</th>|;
285
  $column_header{"$form->{db}number"} =
286
    qq|<th><a class=listheading href=$href&sort=$form->{db}number>$number</a></th>|;
287
  $column_header{name} =
288
      qq|<th><a class=listheading href=$href&sort=name>|
289
    . $locale->text('Name')
290
    . qq|</a></th>|;
291
  $column_header{address} =
292
      qq|<th><a class=listheading href=$href&sort=address>|
293
    . $locale->text('Address')
294
    . qq|</a></th>|;
295
  $column_header{contact} =
296
      qq|<th><a class=listheading href=$href&sort=contact>|
297
    . $locale->text('Contact')
298
    . qq|</a></th>|;
299
  $column_header{phone} =
300
      qq|<th><a class=listheading href=$href&sort=phone>|
301
    . $locale->text('Phone')
302
    . qq|</a></th>|;
303
  $column_header{fax} =
304
      qq|<th><a class=listheading href=$href&sort=fax>|
305
    . $locale->text('Fax')
306
    . qq|</a></th>|;
307
  $column_header{email} =
308
      qq|<th><a class=listheading href=$href&sort=email>|
309
    . $locale->text('E-mail')
310
    . qq|</a></th>|;
311
  $column_header{cc} =
312
      qq|<th><a class=listheading href=$href&sort=cc>|
313
    . $locale->text('Cc')
314
    . qq|</a></th>|;
315

  
316
  $column_header{taxnumber} =
317
      qq|<th><a class=listheading href=$href&sort=taxnumber>|
318
    . $locale->text('Tax Number')
319
    . qq|</a></th>|;
320
  $column_header{sic_code} =
321
      qq|<th><a class=listheading href=$href&sort=sic_code>|
322
    . $locale->text('SIC')
323
    . qq|</a></th>|;
324
  $column_header{business} =
325
      qq|<th><a class=listheading href=$href&sort=business>|
326
    . $locale->text('Type of Business')
327
    . qq|</a></th>|;
328

  
329
  $column_header{invnumber} =
330
      qq|<th><a class=listheading href=$href&sort=invnumber>|
331
    . $locale->text('Invoice')
332
    . qq|</a></th>|;
333
  $column_header{ordnumber} =
334
      qq|<th><a class=listheading href=$href&sort=ordnumber>|
335
    . $locale->text('Order')
336
    . qq|</a></th>|;
337
  $column_header{quonumber} =
338
      qq|<th><a class=listheading href=$href&sort=quonumber>|
339
    . $locale->text('Quotation')
340
    . qq|</a></th>|;
341

  
342
  $label = ucfirst $form->{db} . "s";
343
  $form->{title} = $locale->text($label);
344

  
345
  $form->header;
346

  
347
  print qq|
348
<body>
349

  
350
<table width=100%>
351
  <tr>
352
    <th class=listtop>$form->{title}</th>
353
  </tr>
354
  <tr height="5"></tr>
355
  <tr>
356
    <td>$option</td>
357
  </tr>
358
  <tr>
359
    <td>
360
      <table width=100%>
361
	<tr class=listheading>
362
|;
363

  
364
  map { print "$column_header{$_}\n" } @column_index;
365

  
366
  print qq|
367
        </tr>
368
|;
248
  my @columns = (
249
    'id',        'name',  "$form->{db}number", 'address',  'contact',  'phone',
250
    'fax',       'email', 'taxnumber',         'sic_code', 'business', 'invnumber',
251
    'ordnumber', 'quonumber'
252
  );
253

  
254
  my %column_defs = (
255
    'id'                => { 'text' => $locale->text('ID'), },
256
    "$form->{db}number" => { 'text' => $form->{IS_CUSTOMER} ? $locale->text('Customer Number') : $locale->text('Vendor Number'), },
257
    'name'              => { 'text' => $locale->text('Name'), },
258
    'address'           => { 'text' => $locale->text('Address'), },
259
    'contact'           => { 'text' => $locale->text('Contact'), },
260
    'phone'             => { 'text' => $locale->text('Phone'), },
261
    'fax'               => { 'text' => $locale->text('Fax'), },
262
    'email'             => { 'text' => $locale->text('E-mail'), },
263
    'cc'                => { 'text' => $locale->text('Cc'), },
264
    'taxnumber'         => { 'text' => $locale->text('Tax Number'), },
265
    'sic_code'          => { 'text' => $locale->text('SIC'), },
266
    'business'          => { 'text' => $locale->text('Type of Business'), },
267
    'invnumber'         => { 'text' => $locale->text('Invoice'), },
268
    'ordnumber'         => { 'text' => $form->{IS_CUSTOMER} ? $locale->text('Sales Order') : $locale->text('Purchase Order'), },
269
    'quonumber'         => { 'text' => $form->{IS_CUSTOMER} ? $locale->text('Quotation')   : $locale->text('Request for Quotation'), },
270
  );
271

  
272
  map { $column_defs{$_}->{visible} = $form->{"l_$_"} eq 'Y' } @columns;
273

  
274
  my @hidden_variables  = (qw(db status obsolete), map { "l_$_" } @columns);
275
  my @hidden_nondefault = grep({ $form->{$_} } @hidden_variables);
276
  my $callback          = build_std_url('action=list_names', grep { $form->{$_} } @hidden_variables);
277
  $form->{callback}     = "$callback&sort=" . E($form->{sort});
278

  
279
  map { $column_defs{$_}->{link} = "${callback}&sort=${_}" } @columns;
280

  
281
  my ($ordertype, $quotationtype, $attachment_basename);
282
  if ($form->{IS_CUSTOMER}) {
283
    $form->{title}       = $locale->text('Customers');
284
    $ordertype           = 'sales_order';
285
    $quotationtype       = 'sales_quotation';
286
    $attachment_basename = $locale->text('customer_list');
369 287

  
370
  $ordertype = ($form->{db} eq 'customer') ? 'sales_order' : 'purchase_order';
371
  $quotationtype =
372
    ($form->{db} eq 'customer') ? 'sales_quotation' : 'request_quotation';
373

  
374
  foreach $ref (@{ $form->{CT} }) {
288
  } else {
289
    $form->{title}       = $locale->text('Vendors');
290
    $ordertype           = 'purchase_order';
291
    $quotationtype       = 'request_quotation';
292
    $attachment_basename = $locale->text('vendor_list');
293
  }
375 294

  
376
    if ($ref->{id} eq $sameid) {
377
      map { $column_data{$_} = "<td>&nbsp;</td>" } @column_index;
378
    } else {
379
      map { $column_data{$_} = "<td>$ref->{$_}&nbsp;</td>" } @column_index;
295
  my $report = SL::ReportGenerator->new(\%myconfig, $form);
380 296

  
381
      map { $column_data{$_} = "<td>$ref->{$_}&nbsp;</td>" }
382
        (invnumber, ordnumber, quonumber);
297
  $report->set_options('top_info_text'         => join("\n", @options),
298
                       'raw_bottom_info_text'  => $form->parse_html_template2('ct/list_names_bottom'),
299
                       'output_format'         => 'HTML',
300
                       'title'                 => $form->{title},
301
                       'attachment_basename'   => $attachment_basename . strftime('_%Y%m%d', localtime time),
302
    );
303
  $report->set_options_from_form();
383 304

  
384
      $column_data{name} =
385
        "<td align=left><a href=$form->{script}?action=edit&id=$ref->{id}&db=$form->{db}&login=$form->{login}&password=$form->{password}&status=$form->{status}&callback=$callback>$ref->{name}&nbsp;</td>";
305
  $report->set_columns(%column_defs);
306
  $report->set_column_order(@columns);
386 307

  
387
      if ($ref->{email}) {
388
        $email = $ref->{email};
389
        $email =~ s/</\&lt;/;
390
        $email =~ s/>/\&gt;/;
308
  $report->set_export_options('list_names', @hidden_variables);
391 309

  
392
        $column_data{email} =
393
          qq|<td><a href="mailto:$ref->{email}">$email</a></td>|;
394
      }
310
  $report->set_sort_indicator($form->{sort}, 1);
395 311

  
396
    }
312
  my $previous_id;
397 313

  
398
    if ($ref->{formtype} eq 'invoice') {
399
      $column_data{invnumber} =
400
        "<td><a href=$ref->{module}.pl?action=edit&id=$ref->{invid}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{invnumber}&nbsp;</td>";
401
    }
314
  foreach my $ref (@{ $form->{CT} }) {
315
    my $row = { map { $_ => { 'data' => '' } } @columns };
402 316

  
403
    if ($ref->{formtype} eq 'order') {
404
      $column_data{ordnumber} =
405
        "<td><a href=$ref->{module}.pl?action=edit&id=$ref->{invid}&type=$ordertype&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{ordnumber}&nbsp;</td>";
406
    }
317
    if ($ref->{id} ne $previous_id) {
318
      $previous_id = $ref->{id};
319
      map { $row->{$_}->{data} = $ref->{$_} } @columns;
407 320

  
408
    if ($ref->{formtype} eq 'quotation') {
409
      $column_data{quonumber} =
410
        "<td><a href=$ref->{module}.pl?action=edit&id=$ref->{invid}&type=$quotationtype&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{quonumber}&nbsp;</td>";
321
      $row->{name}->{link}  = build_std_url('action=edit', 'id=' . E($ref->{id}), 'callback', @hidden_nondefault);
322
      $row->{email}->{link} = 'mailto:' . E($ref->{email});
411 323
    }
412 324

  
413
    $i++;
414
    $i %= 2;
415
    print "
416
        <tr class=listrow$i>
417
";
418

  
419
    map { print "$column_data{$_}\n" } @column_index;
420

  
421
    print qq|
422
        </tr>
423
|;
424

  
425
    $sameid = $ref->{id};
325
    my $base_url              = build_std_url("script=$ref->{module}.pl", 'action=edit', 'id=' . E($ref->{invid}), 'callback', @hidden_nondefault);
326
    $row->{invnumber}->{link} = $base_url;
327
    $row->{ordnumber}->{link} = $base_url . "&type=${ordertype}";
328
    $row->{quonumber}->{link} = $base_url . "&type=${quotationtype}";
329
    my $column                = $ref->{formtype} eq 'invoice' ? 'invnumber' : $ref->{formtype} eq 'order' ? 'ordnumber' : 'quonumber';
330
    $row->{$column}->{data}   = $ref->{$column};
426 331

  
332
    $report->add_data($row);
427 333
  }
428 334

  
429
  print qq|
430
      </table>
431
    </td>
432
  </tr>
433
  <tr>
434
    <td><hr size=3 noshade></td>
435
  </tr>
436
</table>
437

  
438
<br>
439
<form method=post action=$form->{script}>
440

  
441
<input name=callback type=hidden value="$form->{callback}">
442
<input name=db type=hidden value=$form->{db}>
443

  
444
<input type=hidden name=login value=$form->{login}>
445
<input type=hidden name=password value=$form->{password}>
446

  
447
<input class=submit type=submit name=action value="|
448
    . $locale->text('Add') . qq|">
449

  
450
  </form>
451

  
452
</body>
453
</html>
454
|;
335
  $report->generate_with_headers();
455 336

  
456 337
  $lxdebug->leave_sub();
457 338
}
locale/de/all
726 726
  'New Buchungsgruppe <TMPL_VAR __counter__>' => 'Neue Buchungsgruppe <TMPL_VAR __counter__>',
727 727
  'New Templates'               => 'neue Vorlagen',
728 728
  'New contact'                 => 'Neuer Ansprechpartner',
729
  'New customer'                => 'Neuer Kunde',
729 730
  'New sales order'             => 'Neuer Auftrag',
730 731
  'New unit'                    => 'Neue Einheit',
732
  'New vendor'                  => 'Neuer Lieferante',
731 733
  'Next Dunning Level'          => 'N?chste Mahnstufe',
732 734
  'No'                          => 'Nein',
733 735
  'No Company Address given'    => 'Keine Firmenadresse hinterlegt!',
......
1276 1278
  'close'                       => 'schlie?en',
1277 1279
  'config'                      => 'Konfiguration',
1278 1280
  'continue'                    => 'weiter',
1281
  'customer_list'               => 'kundenliste',
1279 1282
  'customernumber not unique!'  => 'Die Kundennummer ist schon vergeben',
1280 1283
  'debug'                       => 'Debug',
1281 1284
  'delete'                      => 'L?schen',
......
1350 1353
  'use program settings'        => 'benutze Programmeinstellungen',
1351 1354
  'ustva'                       => 'UStVA',
1352 1355
  'valid from'                  => 'G?ltig ab',
1356
  'vendor_list'                 => 'lieferantenliste',
1353 1357
  'winston_export'              => 'Winston-Export',
1354 1358
  'wrongformat'                 => 'Falsches Format',
1355 1359
  'yes'                         => 'ja',
locale/de/ct
3 3
  'ADDED'                       => 'Hinzugef?gt',
4 4
  'Abteilung'                   => 'Abteilung',
5 5
  'Account Number'              => 'Kontonummer',
6
  'Add'                         => 'Erfassen',
7 6
  'Add Customer'                => 'Kunde erfassen',
8 7
  'Add Vendor'                  => 'Lieferant erfassen',
9 8
  'Address'                     => 'Adresse',
......
17 16
  'Bin List'                    => 'Lagerliste',
18 17
  'Birthday'                    => 'Geburtstag',
19 18
  'CANCELED'                    => 'Storniert',
19
  'CSV export -- options'       => 'CSV-Export -- Optionen',
20 20
  'Cannot delete customer!'     => 'Kunde kann nicht gel?scht werden!',
21 21
  'Cannot delete vendor!'       => 'Lieferant kann nicht gel?scht werden!',
22 22
  'Cc'                          => 'Cc',
......
25 25
  'Confirmation'                => 'Auftragsbest?tigung',
26 26
  'Contact'                     => 'Kontakt',
27 27
  'Continue'                    => 'Weiter',
28
  'Could not spawn html2ps or GhostScript.' => 'html2ps oder GhostScript konnte nicht gestartet werden.',
29
  'Could not spawn the printer command.' => 'Die Druckanwendung konnte nicht gestartet werden.',
30
  'Could not write the html2ps config file.' => 'Die tempor&auml;re html2ps-Konfigurationsdatei konnte nicht geschrieben werden.',
31
  'Could not write the temporary HTML file.' => 'Eine tempor&auml;re HTML-Datei konnte nicht geschrieben werden.',
28 32
  'Country'                     => 'Land',
29 33
  'Credit Limit'                => 'Kreditlimit',
30 34
  'Credit Note'                 => 'Gutschrift',
......
89 93
  'Orders'                      => 'Auftr?ge',
90 94
  'Orphaned'                    => 'Nie benutzt',
91 95
  'PAYMENT POSTED'              => 'Rechung gebucht',
96
  'PDF export -- options'       => 'PDF-Export -- Optionen',
92 97
  'POSTED'                      => 'Gebucht',
93 98
  'POSTED AS NEW'               => 'Als neu gebucht',
94 99
  'PRINTED'                     => 'Gedruckt',
......
113 118
  'Quotation'                   => 'Angebot',
114 119
  'Quotations'                  => 'Angebote',
115 120
  'RFQ'                         => 'Anfrage',
121
  'Request for Quotation'       => 'Anfrage',
116 122
  'SAVED'                       => 'Gespeichert',
117 123
  'SAVED FOR DUNNING'           => 'Gespeichert',
118 124
  'SCREENED'                    => 'Angezeigt',
119 125
  'SIC'                         => 'SIC',
126
  'Sales Order'                 => 'Kundenauftrag',
120 127
  'Salesman'                    => 'Verk?ufer/in',
121 128
  'Sat. Fax'                    => 'Sat. Fax',
122 129
  'Sat. Phone'                  => 'Sat. Tel.',
......
140 147
  'Tax Number'                  => 'Steuernummer',
141 148
  'Tax Number / SSN'            => 'Steuernummer',
142 149
  'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.',
150
  'The list has been printed.'  => 'Die Liste wurde ausgedruckt.',
143 151
  'This customer number is already in use.' => 'Diese Kundennummer wird bereits verwendet.',
144 152
  'This vendor number is already in use.' => 'Diese Lieferantennummer wird bereits verwendet.',
145 153
  'Title'                       => 'Titel',
......
159 167
  'Vendors'                     => 'Lieferanten',
160 168
  'Zipcode'                     => 'PLZ',
161 169
  'bin_list'                    => 'Lagerliste',
170
  'customer_list'               => 'kundenliste',
162 171
  'customernumber not unique!'  => 'Die Kundennummer ist schon vergeben',
163 172
  'history'                     => 'Historie',
164 173
  'invoice'                     => 'Rechnung',
......
167 176
  'pick_list'                   => 'Entnahmeliste',
168 177
  'proforma'                    => 'Proforma',
169 178
  'purchase_order'              => 'Auftrag',
179
  'report_generator_dispatch_to is not defined.' => 'report_generator_dispatch_to ist nicht definiert.',
180
  'report_generator_nextsub is not defined.' => 'report_generator_nextsub ist nicht definiert.',
170 181
  'request_quotation'           => 'Angebotsanforderung',
171 182
  's'                           => 's',
172 183
  'sales_order'                 => 'Kundenauftrag',
173 184
  'sales_quotation'             => 'Verkaufsangebot',
185
  'vendor_list'                 => 'lieferantenliste',
174 186
  'yes'                         => 'ja',
175 187
};
176 188

  
......
201 213
  'part_selection_internal'     => 'part_selection_internal',
202 214
  'project_selection_internal'  => 'project_selection_internal',
203 215
  'reformat_numbers'            => 'reformat_numbers',
216
  'report_generator_back'       => 'report_generator_back',
217
  'report_generator_dispatcher' => 'report_generator_dispatcher',
218
  'report_generator_do'         => 'report_generator_do',
219
  'report_generator_export_as_csv' => 'report_generator_export_as_csv',
220
  'report_generator_export_as_pdf' => 'report_generator_export_as_pdf',
204 221
  'save'                        => 'save',
205 222
  'save_and_ap_transaction'     => 'save_and_ap_transaction',
206 223
  'save_and_ar_transaction'     => 'save_and_ar_transaction',
templates/webpages/ct/list_names_bottom_de.html
1
[% USE HTML %]<form method="post" action="ct.pl">
2

  
3
 <input name="callback" type="hidden" value="[% HTML.escape(callback) %]">
4
 <input name="db" type="hidden" value="[% HTML.escape(db) %]">
5

  
6
 <input name="login" type="hidden" value="[% HTML.escape(login) %]">
7
 <input name="password" type="hidden" value="[% HTML.escape(password) %]">
8

  
9
 [% IF IS_CUSTOMER %]Neuer Kunde[% ELSE %]Neuer Lieferante[% END %]<br>
10

  
11
 <input class="submit" type="submit" name="action" value="Erfassen">
12

  
13
</form>
templates/webpages/ct/list_names_bottom_master.html
1
[% USE HTML %]<form method="post" action="ct.pl">
2

  
3
 <input name="callback" type="hidden" value="[% HTML.escape(callback) %]">
4
 <input name="db" type="hidden" value="[% HTML.escape(db) %]">
5

  
6
 <input name="login" type="hidden" value="[% HTML.escape(login) %]">
7
 <input name="password" type="hidden" value="[% HTML.escape(password) %]">
8

  
9
 [% IF IS_CUSTOMER %]<translate>New customer</translate>[% ELSE %]<translate>New vendor</translate>[% END %]<br>
10

  
11
 <input class="submit" type="submit" name="action" value="<translate>Add</translate>">
12

  
13
</form>

Auch abrufbar als: Unified diff