Subversion Repositories public

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4 andreas 1
<?
2
require_once('version.inc');
3
require_once('dbaccess.inc');
4
require_once('language.inc');
5
require_once('helper.inc');
6
require_once('crypt.inc');
7
require_once('settings.inc');
8
 
9
$knopf = 0;
10
$func = $_REQUEST['func'];
11
 
12
# Auswertungsmenue
13
if (isset($_REQUEST['auswertung'])) { $knopf = 27; $headline = 31; }
14
 
15
$drm = array(true, false, false, false, false, true, false);
16
 
17
$helvN = 0;
18
$helvB = 0;
19
$page = 0;
20
$SearchPath = "/usr/share/fonts/afms/adobe";
21
$pwidth = 842;
22
$pheight = 595;
23
//$pwidth = 595;
24
//$pheight = 842;
25
$fact = -1;		// Seitenscalierungsfaktor
26
 
27
//require_once('menu.inc');
28
require_once('knumber.inc');
29
require_once('tempplan.inc');
30
 
31
# This module contains the following functions:
32
#    HeadLine
33
#    ZSumPDF
34
#    CellPDF
35
#    ProjektMaPDF
36
#    MitarbeiterPjPDF
37
#    PrintListPDF
38
 
39
# Statische Kopfzeile schreiben
40
#
41
function HeadLine($ps) {
42
	global $helvN;
43
	global $helvB;
44
	global $page;
45
	global $pwidth;
46
	global $pheight;
47
	global $strVersion;
48
	global $SearchPath;
49
	global $title_str;
50
	global $fact;
51
 
52
	$page++;
53
 
54
	PS_begin_page($ps, $pheight, $pwidth);		// Page: A4 landscape
55
	PS_translate($ps, $pheight, 0);
56
	PS_rotate($ps, 90);
57
 
58
	PS_setfont($ps, $helvN, 8.0);
59
	PS_setlinewidth($ps, 0.4);
60
	PS_show_xy($ps, "$title_str v" . $strVersion, 10, $pheight - 15);
61
	$datum = date("j.n.Y", time());
62
	$len = PS_stringwidth($ps, $datum);
63
	PS_show_xy($ps, $datum, ($pwidth / 2) - ($len / 2), $pheight - 15);
64
	$text = "Seite $page";
65
	$len = PS_stringwidth($ps, $text);
66
	PS_show_xy($ps, $text, $pwidth - 10 - $len, $pheight - 15);
67
 
68
	if ($fact > -1)
69
	   PS_scale($ps, $fact, 1);
70
}
71
 
72
# Zeilensumme ausgeben
73
#
74
function ZSumPDF($ps, $sumi, $sump, $x, $y, $width) {
75
	global $helvB;
76
	global $helvN;
77
	$fields_3 = $_REQUEST['fields_3'];
78
	$fields_4 = $_REQUEST['fields_4'];
79
	$fields_5 = $_REQUEST['fields_5'];
80
 
81
	PS_setcolor($ps, "fill", "gray", 0.8, 0.0, 0.0, 0.0);
82
	PS_setfont($ps, $helvB, 10.0);
83
 
84
	if ($fields_4 > 0) {
85
	   $num = FormatNum($sumi, 3);
86
	   $len = PS_stringwidth($ps, $num);
87
	   PS_rect($ps, $x - 2, $y - 1, $width + 4, 10);
88
	   PS_fill($ps);
89
	   PS_rect($ps, $x - 2, $y - 1, $width + 4, 10);
90
	   PS_stroke($ps);
91
	   PS_show_xy($ps, $num, $x + $width - $len, $y);
92
	   $x += $width + 4;
93
	}
94
 
95
	if ($fields_3 > 0) {
96
	   $num = FormatNum($sump - $sumi, 3);
97
	   $len = PS_stringwidth($ps, $num);
98
	   PS_moveto($ps, $x - $len - 2, $y);
99
	   PS_rect($ps, $x - 2, $y - 1, $width + 4, 10);
100
	   PS_fill($ps);
101
	   PS_rect($ps, $x - 2, $y - 1, $width + 4, 10);
102
	   PS_stroke($ps);
103
	   PS_show_xy($ps, $num, $x + $width - $len, $y);
104
	   $x += $width + 4;
105
	}
106
 
107
	if ($fields_5 > 0) {
108
	   $num = FormatNum($sump, 3);
109
	   $len = PS_stringwidth($ps, $num);
110
	   PS_moveto($ps, $x - $len - 2, $y);
111
	   PS_rect($ps, $x - 2, $y - 1, $width + 4, 10);
112
	   PS_fill($ps);
113
	   PS_rect($ps, $x - 2, $y - 1, $width + 4, 10);
114
	   PS_stroke($ps);
115
	   PS_show_xy($ps, $num, $x + $width - $len, $y);
116
	   $x += $width + 4;
117
	}
118
 
119
	PS_setcolor($ps, "fill", "gray", 1.0, 0.0, 0.0, 0.0);
120
	PS_setfont($ps, $helvN, 10.0);
121
	return $x;
122
}
123
 
124
# Schreiben einer Zelle
125
#
126
function CellPDF($ps, $ist, $plan, $x, $y, $width, $shade, $blank=false) {
127
	$fields_3 = $_REQUEST['fields_3'];
128
	$fields_4 = $_REQUEST['fields_4'];
129
	$fields_5 = $_REQUEST['fields_5'];
130
 
131
	if ($shade)
132
	   PS_setcolor($ps, "fill", "gray", 0.9, 0.0, 0.0, 0.0);
133
	else
134
	   PS_setcolor($ps, "fill", "gray", 1.0, 0.0, 0.0, 0.0);
135
 
136
	if ($fields_4 > 0) {
137
	   PS_rect($ps, $x-2, $y-1, $width + 4, 10);
138
 
139
	   if ($shade) {
140
	      PS_fill($ps);
141
	      PS_rect($ps, $x-2, $y-1, $width + 4, 10);
142
	   }
143
 
144
	   PS_stroke($ps);
145
 
146
	   if (!$blank) {
147
	      $num = FormatNum($ist, 3);
148
	      $len = PS_stringwidth($ps, $num);
149
	      PS_show_xy($ps, $num, $x + $width - $len, $y);
150
	   }
151
 
152
	   $x += $width + 4;
153
	}
154
 
155
	if ($fields_3 > 0) {
156
	   PS_rect($ps, $x-2, $y-1, $width + 4, 10);
157
 
158
	   if ($shade) {
159
	      PS_fill($ps);
160
	      PS_rect($ps, $x-2, $y-1, $width + 4, 10);
161
	   }
162
 
163
	   PS_stroke($ps);
164
 
165
	   if (!$blank) {
166
	      $num = FormatNum($plan - $ist, 3);
167
	      $len = PS_stringwidth($ps, $num);
168
	      PS_show_xy($ps, $num, $x + $width - $len, $y);
169
	   }
170
 
171
	   $x += $width + 4;
172
	}
173
 
174
	if ($fields_5 > 0) {
175
	   PS_rect($ps, $x-2, $y-1, $width + 4, 10);
176
 
177
	   if ($shade) {
178
	      PS_fill($ps);
179
	      PS_rect($ps, $x-2, $y-1, $width + 4, 10);
180
	   }
181
 
182
	   PS_stroke($ps);
183
 
184
	   if (!$blank) {
185
	      $num = FormatNum($plan, 3);
186
	      $len = PS_stringwidth($ps, $num);
187
	      PS_show_xy($ps, $num, $x + $width - $len, $y);
188
	   }
189
 
190
	   $x += $width + 4;
191
	}
192
 
193
	return $x;
194
}
195
 
196
# Folgende Funktion erzeugt die Liste aller Projekte. Die Liste
197
# sortiert nach Projekten und Mitarbeitern (Projektsicht).
198
#
199
function ProjektMaPDF($ps, $db, $pr_num, $ystart, $mi_num=0) {
200
	global $periode;
201
	global $phase;
202
	global $helvN;
203
	global $helvB;
204
	global $page;
205
	global $pwidth;
206
	global $pheight;
207
	global $SearchPath;
208
	global $fact;
209
 
210
	$pl_num = $_REQUEST['pl_num'];
211
	$dfrom = $_REQUEST['dfrom'];
212
	$dto = $_REQUEST['dto'];
213
	$fields_0 = $_REQUEST['fields_0'];
214
	$fields_1 = $_REQUEST['fields_1'];
215
	$fields_2 = $_REQUEST['fields_2'];
216
	$fields_3 = $_REQUEST['fields_3'];
217
	$fields_4 = $_REQUEST['fields_4'];
218
	$fields_5 = $_REQUEST['fields_5'];
219
	$fields_6 = $_REQUEST['fields_6'];
220
	$sort = $_REQUEST['sort'];
221
	$level = $_REQUEST['level'];
222
	$pjclosed = $_REQUEST['pjclosed'];
223
	$scaled = false;
224
 
225
	if (isset($pjclosed) && CheckTrue($pjclosed))
226
	   $pjc = ",6";
227
 
228
	# Festlegen der Spaltenlaengen
229
	$lenma = PS_stringwidth($ps, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
230
	$lengr = PS_stringwidth($ps, "XXXXXXXXXXXXXXX");
231
	$lenph = PS_stringwidth($ps, "9: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
232
	$lenta = $lenma;
233
	$lenan = PS_stringwidth($ps, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
234
	$lence = PS_stringwidth($ps, "999,999");
235
	$lentotal = 0;
236
 
237
	# Beim bis-Datum den Monatsletzten ermitteln
238
	$mon = gmdate("n", $dto);
239
	$year = gmdate("Y", $dto);
240
	$day = daysinmonth($mon, $year);
241
	$dto = gmmktime(23, 59, 59, $mon, $day, $year);
242
	# Den Projektnamen ermitteln
243
	$query = "select pr_num, pr_name, pr_status from project ";
244
 
245
	if ($pr_num > 0)
246
	   $query .= "where pr_num = $pr_num ";
247
 
248
	$query .= "order by pr_num";
249
	$respr = QueryDB($db, $query);
250
 
251
	if (!$respr)
252
	   return;
253
 
254
	$numpr = numrowsDB($respr);
255
	$pospr = 0;
256
 
257
	$pdiff = $fields_3;
258
	$pist = $fields_4;
259
	$pplan = $fields_5;
260
	$mult = 0;
261
	$y = $ystart;
262
	$x = 40;
263
 
264
	if ($pist > 0)
265
	   $mult++;
266
 
267
	if ($pplan > 0)
268
	   $mult++;
269
 
270
	if ($pplan > 0 && $pdiff > 0)
271
	   $mult++;
272
 
273
	# Errechnen der gesamten Laenge; Zu jeder Zelle wird ein Rand von
274
	# 2 PT gerechnet.
275
	#
276
	$lenganz = $lenma + 4 + ($lence * $mult) + ($mult * 4);
277
	$csp = $lenma + 4;
278
 
279
	if ($fields_6 > 0) {
280
	   $lenganz += ($lenph + 4);
281
	   $csp += ($lenph + 4);
282
	}
283
 
284
	if ($fields_0 > 0) {
285
	   $lenganz += ($lenta + 4);
286
	   $csp += ($lenta + 4);
287
	}
288
 
289
	if ($fields_1 > 0) {
290
	   $lenganz += ($lenan + 4);
291
	   $csp += ($lenan + 4);
292
	}
293
 
294
	if ($fields_2 > 0) {
295
	   $lenganz += ($lengr + 4);
296
	   $csp += ($lengr + 4);
297
	}
298
 
299
	$pl_flag = false;
300
	$TempTable = false;
301
 
302
	while ($pospr < $numpr) {
303
	   $data = fetchDB($respr, $pospr);
304
	   $pr_num = $data[0];
305
	   $pr_name = $data[1];
306
	   $pr_status = $data[2];
307
	   $lentotal = $lenganz;
308
 
309
	   # Wurde kein Projekt gewaehlt, dann muessen wir die Plannummer
310
	   # ermitteln. In diesem Fall zeigen wir immer den aktuelsten Plan
311
	   # an.
312
	   #
313
	   if ($pl_flag || !isset($pl_num) || $pl_num <= 0) {
314
	      $query = "select pl_num from plan where pl_prnum = $pr_num order by pl_num desc";
315
	      $result = QueryDB($db, $query);
316
 
317
	      if (!$result)
318
	         return;
319
 
320
	      if (numrowsDB($result) > 0) {
321
	         $data = fetchDB($result, 0);
322
	         $pl_num = $data[0];
323
	         $pl_flag = true;
324
	      } else {
325
	         $pl_num = 0;
326
	         $pl_flag = false;
327
	         $pospr++;
328
	         continue;
329
	      }
330
	   }
331
 
332
	   if ($TempTable && $pospr > 0)
333
	      TQueryDB($db, "drop table TempPlan");
334
 
335
	   $TempTable = true;
336
	   if (!CreateTempPlan($db, $pl_num, $pr_num, $dfrom, $dto, true)) {
337
	      $pospr++;
338
	      continue;
339
	   }
340
 
341
	   # Wieviele Perioden gibt es insgesamt?
342
	   $query = "select count(distinct tmp_periode) from TempPlan";
343
	   $result = QueryDB($db, $query);
344
 
345
	   if (!$result) {
346
	      closeDB($db);
347
	      return;
348
	   }
349
 
350
	   $data = fetchDB($result, 0);
351
	   $numper = $data[0];
352
 
353
	   # Keine Datensaetze, dann keine Tabelle malen...
354
	   if ($numper == 0) {
355
	      $pospr++;
356
	      continue;
357
	   }
358
 
359
	   # Die totale Laenge ist immer die Maximale, welche auf Grund des
360
	   # ausgewaehlten Zeitraums moeglich ist-
361
	   #
362
	   $dt = $dfrom;
363
	   $r = 0;
364
 
365
	   while ($dt < $dto) {
366
	      $dt = IncDate($periode, $dt);
367
	      $r++;
368
	   }
369
 
370
	   $len = $lentotal + (($r * ($lence + 4)) * $mult);
371
 
372
	   # Wenn die benoetigte Breite die zur Verfuegung stehende
373
	   # ueberschreitet, dann skalieren wir die Ausgabe so, dass sich
374
	   # alles in der Breite ausgeht.
375
	   if ($fact == -1 && $len > ($pwidth - 50)) {
376
	      $fact = ($pwidth - 50) / $len;
377
	      PS_scale($ps, $fact, 1);
378
	   }
379
 
380
	   $lentotal += (($numper * ($lence + 4)) * $mult);
381
	   # Zeichnen des Tabellenkopfs
382
	   PS_setcolor($ps, "fill", "gray", 0.7, 0.0, 0.0, 0.0);
383
	   PS_rect($ps, $x - 2, $y-1, $lentotal, 10);
384
	   PS_fill($ps);
385
	   PS_setcolor($ps, "fill", "gray", 1.0, 0.0, 0.0, 0.0);
386
	   PS_setfont($ps, $helvB, 10.0);
387
	   PS_show_xy($ps, "Projekt: $pr_num $pr_name", $x, $y);
388
	   PS_rect($ps, $x - 2, $y-1, $lentotal, 10);
389
	   PS_moveto($ps, $x - 2, $y);
390
	   PS_lineto($ps, $x - 2, $y - 12);
391
	   PS_stroke($ps);
392
	   $y -= 10;
393
	   $x = 38 + $csp;
394
 
395
	   # Ermitteln der einzelnen Perioden und Darstellung der Selben.
396
	   #
397
	   $query = "select distinct tmp_periode from TempPlan order by tmp_periode";
398
	   $result = QueryDB($db, $query);
399
 
400
	   # Wurde kein Projekt gewaehlt, dann muessen wir die Plannummer
401
	   # ermitteln. In diesem Fall zeigen wir immer den aktuelsten Plan
402
	   # an.
403
 
404
	   if (!$result) {
405
	      return;
406
	   }
407
 
408
	   $numrows = numrowsDB($result);
409
	   $r = 0;
410
	   $j = 0;
411
 
412
	   while ($r < $numrows) {
413
	      $data = fetchDB($result, $r);
414
	      $tmp_periode = $data[0];
415
 
416
	      $mon = gmdate("n", $tmp_periode);
417
	      $year = gmdate("Y", $tmp_periode);
418
 
419
	      if ($r == 0) {
420
	         $fdate = $tmp_periode;
421
	         $adate = $fdate;
422
	      }
423
 
424
	      while ($adate < $tmp_periode) {
425
	         $p = gmdate("n/Y", $adate);
426
	         $len = ($lence + 4) * $mult;
427
	         $slen = PS_stringwidth($ps, $p);
428
	         $mid = $slen / 2 + 2;
429
	         PS_show_xy($ps, $p, $x + $mid, $y);
430
	         PS_rect($ps, $x, $y-1, $len, 10);
431
	         PS_stroke($ps);
432
	         $adate = IncDate($periode, $adate);
433
	         $sumperp[$j] = 0.0;
434
	         $sumperi[$j] = 0.0;
435
	         $totalis[$j] = 0.0;
436
	         $totalpl[$j] = 0.0;
437
	         $x += $len;
438
	         $j++;
439
	      }
440
 
441
	      $len = ($lence + 4) * $mult;
442
	      $slen = PS_stringwidth($ps, "$mon/$year");
443
	      $mid = $slen / 2 + 2;
444
	      PS_show_xy($ps, "$mon/$year", $x + $mid, $y);
445
	      PS_rect($ps, $x, $y-1, $len, 10);
446
	      PS_stroke($ps);
447
	      $sumperp[$j] = 0.0;
448
	      $sumperi[$j] = 0.0;
449
	      $totalis[$j] = 0.0;
450
	      $totalpl[$j] = 0.0;
451
	      $adate = IncDate($periode, $adate);
452
	      $r++;
453
	      $j++;
454
	      $x += $len;
455
	   }
456
 
457
	   $ldate = $tmp_periode;
458
	   $slen = PS_stringwidth($ps, GetMessage($db, 290, "Summen"));
459
	   $mid = $slen / 2 + 2;
460
	   PS_show_xy($ps, GetMessage($db, 290, "Summen"), $x + $mid, $y);
461
	   PS_rect($ps, $x, $y-1, $len, 10);
462
	   PS_stroke($ps);
463
	   $y -= 10;
464
	   $x = 40;
465
 
466
	   PS_show_xy($ps, GetMessage($db, 66, "Mitarbeiter"), $x, $y);
467
	   PS_rect($ps, $x - 2, $y-1, $lenma + 4, 10);
468
	   PS_stroke($ps);
469
	   $x += $lenma + 2;
470
 
471
	   if ($fields_2 > 0) {
472
	      PS_show_xy($ps, GetMessage($db, 291, "Gruppe"), $x, $y);
473
	      PS_rect($ps, $x - 2, $y-1, $lengr + 4, 10);
474
	      PS_stroke($ps);
475
	      $x += $lengr + 4;
476
	   }
477
 
478
	   if ($phase && $fields_6 > 0) {
479
	      PS_show_xy($ps, GetMessage($db, 292, "Phase"), $x, $y);
480
	      PS_rect($ps, $x - 2, $y-1, $lenph + 4, 10);
481
	      PS_stroke($ps);
482
	      $x += $lenph + 4;
483
	   }
484
 
485
	   if ($fields_0 > 0) {
486
	      PS_show_xy($ps, GetMessage($db, 293, "Tasks"), $x, $y);
487
	      PS_rect($ps, $x - 2, $y-1, $lenta + 4, 10);
488
	      PS_stroke($ps);
489
	      $x += $lenta + 4;
490
	   }
491
 
492
	   if ($fields_1 > 0) {
493
	      PS_show_xy($ps, GetMessage($db, 294, "Anmerkungen"), $x, $y);
494
	      PS_rect($ps, $x - 2, $y-1, $lenan + 4, 10);
495
	      PS_stroke($ps);
496
	      $x += $lenan + 4;
497
	   }
498
 
499
	   $r = 0;
500
 
501
	   while ($r <= $j) {
502
	      if ($pist > 0) {
503
	         PS_show_xy($ps, GetMessage($db, 260, "IST"), $x, $y);
504
	         PS_rect($ps, $x - 2, $y-1, $lence + 4, 10);
505
	         PS_stroke($ps);
506
	         $x += $lence + 4;
507
	      }
508
 
509
	      if ($pplan > 0 && $pdiff > 0) {
510
	         PS_show_xy($ps, GetMessage($db, 295, "Diff."), $x, $y);
511
	         PS_rect($ps, $x - 2, $y-1, $lence + 4, 10);
512
	         PS_stroke($ps);
513
	         $x += $lence + 4;
514
	      }
515
 
516
	      if ($pplan > 0) {
517
	         PS_show_xy($ps, GetMessage($db, 278, "Plan"), $x, $y);
518
	         PS_rect($ps, $x - 2, $y-1, $lence + 4, 10);
519
	         PS_stroke($ps);
520
	         $x += $lence + 4;
521
	      }
522
 
523
	      $r++;
524
	   }
525
 
526
	   $x = 40;
527
	   $y -= 10;
528
	   $query = "select tmp_phase, tmp_periode, tmp_plan, tmp_ist,";
529
	   $query .= "tmp_taname, tmp_notiz, mi_nname, mi_vname, kp_phase, ";
530
	   $query .= "kl_land, tmp_miname, tmp_status, tmp_hash ";
531
	   $query .= "from TempPlan, mitarbeiter, key_phase, key_land where ";
532
	   $query .= "mi_num = tmp_miname and kp_num = tmp_phase and kl_num = mi_land ";
533
	   $query .= "order by mi_nname, mi_vname, tmp_phase, tmp_taname, tmp_periode";
534
	   $result = QueryDB($db, $query);
535
	   # Wurde kein Projekt gewaehlt, dann muessen wir die Plannummer
536
	   # ermitteln. In diesem Fall zeigen wir immer den aktuelsten Plan
537
	   # an.
538
 
539
	   if (!$result)
540
	      return;
541
 
542
	   $numrows = numrowsDB($result);
543
	   $rows = 0;
544
	   $oldminame = 0;
545
	   $oldphase = 0;
546
	   $oldtask = "";
547
	   $sumlpl = 0.0;
548
	   $sumlis = 0.0;
549
	   $per = 0;
550
	   $first = true;
551
	   $adate = $fdate;
552
	   $class = false;
553
 
554
	   while ($rows < $numrows) {
555
	      $data = fetchDB($result, $rows);
556
	      $tmp_phase = $data[0];
557
	      $tmp_periode = $data[1];
558
	      $tmp_plan = $data[2];
559
	      $tmp_ist = $data[3];
560
	      $tmp_taname = $data[4];
561
	      $tmp_notiz = $data[5];
562
	      $mi_nname = $data[6];
563
	      $mi_vname = $data[7];
564
	      $kp_phase = $data[8];
565
	      $kl_land = $data[9];
566
	      $tmp_miname = $data[10];
567
	      $tmp_status = $data[11];
568
	      $tmp_hash = $data[12];
569
 
570
	      # Summen und Zeilenanfang schreiben
571
	      #
572
	      if ($oldminame != $tmp_miname || $oldphase != $tmp_phase ||
573
		  $oldtask != $tmp_taname) {
574
		 # Aktuelle Zeile vervollstaendigen (nur wenn eine Zeile
575
		 # bereits geschrieben wurde).
576
		 #
577
		 if (!$first) {
578
		    while ($adate <= $ldate) {
579
		       $x = CellPDF($ps, 0, 0, $x, $y, $lence, $class, true);
580
 
581
		       if ($class)
582
		          $class = false;
583
		       else
584
		          $class = true;
585
 
586
		       $adate = IncDate($periode, $adate);
587
		    }
588
 
589
		    ZSumPDF($ps, $sumlis, $sumlpl, $x, $y, $lence);
590
		    $x = 40;
591
 
592
		    if (isset($y_next) && $y_next > 0) {
593
		       $y = $y_next;
594
		       $y_next = -1;
595
		       unset ($y_next);
596
		    } else
597
		       $y -= 10;
598
 
599
		    if ($y <= 30) {
600
		       PS_end_page($ps);
601
		       HeadLine($ps);
602
		       $y = $pheight - 30;
603
		    }
604
		 }
605
 
606
		 if (!$first && $oldminame != $tmp_miname) {
607
		    # Monatssummen nach einem Mitarbeiterwechsel
608
		    #
609
		    if ($fields_0 > 0 || $fields_6 > 0 && $fields_1 > 0 && $fields_2 > 0) {
610
		       $len = PS_stringwidth($ps, GetMessage($db, 296, "Zwischensumme: "));
611
		       $x = 38 + $csp - $len - 4;
612
		       PS_show_xy($ps, GetMessage($db, 296, "Zwischensumme:"), $x, $y);
613
		       PS_rect($ps, 38, $y-1, $csp-2, 10);
614
		       PS_stroke($ps);
615
		       $x = 38 + $csp;
616
		    }
617
 
618
		    $adate = $fdate;
619
		    $per = 0;
620
		    $sumi = 0.0;
621
		    $sump = 0.0;
622
 
623
		    while ($adate <= $ldate) {
624
		       if ($fields_0 > 0 || $fields_6 > 0 && $fields_1 > 0 && $fields_2 > 0)
625
		          $x = CellPDF($ps, $sumperi[$per], $sumperp[$per], $x, $y, $lence, true);
626
 
627
		       $adate = IncDate($periode, $adate);
628
		       $sumi += $sumperi[$per];
629
		       $sump += $sumperp[$per];
630
		       $sumperi[$per] = 0.0;
631
		       $sumperp[$per] = 0.0;
632
		       $per++;
633
		    }
634
 
635
		    if ($fields_0 > 0 || $fields_6 > 0 && $fields_1 > 0 && $fields_2 > 0) {
636
		       ZsumPDF($ps, $sumi, $sump, $x, $y, $lence);
637
		       $y -= 10;
638
		    }
639
 
640
		    $x = 40;
641
//		    $y -= 10;
642
 
643
		    if ($y <= 30) {
644
		       PS_end_page($ps);
645
		       HeadLine($ps);
646
		       $y = $pheight - 30;
647
		    }
648
		 }
649
 
650
		 # Beginn der Zeile: Schreiben der ersten fixen Zellen.
651
		 #
652
		 PS_setfont($ps, $helvN, 10.0);
653
		 $x = 40;
654
		 PS_show_xy($ps, "$mi_nname $mi_vname", $x, $y);
655
		 PS_rect($ps, $x - 2, $y-1, $lenma + 4, 10);
656
		 PS_stroke($ps);
657
		 $x += $lenma + 2;
658
 
659
		 if ($fields_2 > 0) {
660
		    PS_show_xy($ps, $kl_land, $x, $y);
661
		    PS_rect($ps, $x - 2, $y-1, $lengr + 4, 10);
662
		    PS_stroke($ps);
663
		    $x += $lengr + 4;
664
		 }
665
 
666
		 if ($phase && $fields_6 > 0) {
667
		    if ($tmp_status == 0)
668
		       PS_show_xy($ps, "$tmp_phase: $kp_phase", $x, $y);
669
 
670
		    PS_rect($ps, $x - 2, $y-1, $lenph + 4, 10);
671
		    PS_stroke($ps);
672
		    $x += $lenph + 4;
673
		 }
674
 
675
		 if ($fields_0 > 0) {
676
		    PS_show_xy($ps, $tmp_taname, $x, $y);
677
		    PS_rect($ps, $x - 2, $y-1, $lenta + 4, 10);
678
		    PS_stroke($ps);
679
		    $x += $lenta + 4;
680
		 }
681
 
682
		 if ($fields_1 > 0) {
683
		    if (strlen($tmp_notiz) > 0) {
684
		       $len = PS_stringwidth($ps, $tmp_notiz);
685
 
686
		       if ($len > $lenan)
687
		          $lines = ceil($len / $lenan);
688
		       else
689
		          $lines = 1;
690
 
691
		       PS_show_boxed($ps, $tmp_notiz, $x, ($y + 8) - ($lines * 10), $lenan, $lines * 10, "left");
692
		       PS_rect($ps, $x - 2, (($y + 10) - ($lines * 10))-1, $lenan + 4, $lines * 10);
693
		       $y_next = $y - (($lines - 1) * 10);
694
		    } else {
695
		       PS_show_xy($ps, $tmp_notiz, $x, $y);
696
		       PS_rect($ps, $x - 2, $y-1, $lenan + 4, 10);
697
		    }
698
 
699
		    PS_stroke($ps);
700
		    $x += $lenan + 4;
701
		 }
702
 
703
		 # Variablen initialisieren...
704
		 #
705
		 $sumlis = 0.0;
706
		 $sumlpl = 0.0;
707
		 $per = 0;
708
		 $adate = $fdate;
709
		 $oldminame = $tmp_miname;
710
		 $oldphase = $tmp_phase;
711
		 $oldtask = $tmp_taname;
712
		 $first = false;
713
		 $class = false;
714
	      }
715
 
716
	      # Stimmt die aktuelle Position nicht mit der Periode ueberein,
717
	      # uebergehen wir die Zellen.
718
	      #
719
	      while ($adate < $tmp_periode) {
720
		 $x = CellPDF($ps, 0, 0, $x, $y, $lence, $class, true);
721
 
722
		 if ($class)
723
		    $class = false;
724
		 else
725
		    $class = true;
726
 
727
		 $adate = IncDate($periode, $adate);
728
		 $per++;
729
	      }
730
 
731
	      # Schreiben einer Zelle mit den aktuellen Werten.
732
	      $x = CellPDF($ps, $tmp_ist, $tmp_plan, $x, $y, $lence, $class);
733
 
734
	      if ($class)
735
	         $class = false;
736
	      else
737
	         $class = true;
738
 
739
	      $sumperp[$per] += $tmp_plan;
740
	      $sumperi[$per] += $tmp_ist;
741
	      $totalis[$per] += $tmp_ist;
742
	      $totalpl[$per] += $tmp_plan;
743
	      $sumlpl += $tmp_plan;
744
	      $sumlis += $tmp_ist;
745
	      $adate = IncDate($periode, $adate);
746
	      $per++;
747
	      $rows++;
748
	   }
749
 
750
	   # Beenden der der letzten Datenzeile der aktuellen Tabelle.
751
	   #
752
	   while ($adate <= $ldate) {
753
	      $x = CellPDF($ps, 0, 0, $x, $y, $lence, $class, true);
754
 
755
	      if ($class)
756
	         $class = false;
757
	      else
758
	         $class = true;
759
 
760
	      $adate = IncDate($periode, $adate);
761
	   }
762
 
763
	   ZSumPDF($ps, $sumlis, $sumlpl, $x, $y, $lence);
764
	   $y -= 10;
765
	   $x = 40;
766
 
767
	   if ($y <= 30) {
768
	      PS_end_page($ps);
769
	      HeadLine($ps);
770
	      $y = $pheight - 30;
771
	   }
772
 
773
	   # Summenzeile am Ende der Tabelle fuer den letzten Mitarbeiter
774
	   # anzeigen.
775
	   #
776
	   if ($fields_0 > 0 || $fields_6 > 0 && $fields_1 > 0 && $fields_2 > 0) {
777
	      $len = PS_stringwidth($ps, GetMessage($db, 296, "Zwischensumme: "));
778
	      $x = 38 + $csp - $len - 4;
779
	      PS_show_xy($ps, GetMessage($db, 296, "Zwischensumme:"), $x, $y);
780
	      PS_rect($ps, 38, $y-1, $csp-2, 10);
781
	      PS_stroke($ps);
782
	      $x = 38 + $csp;
783
	      $adate = $fdate;
784
	      $per = 0;
785
	      $sumi = 0.0;
786
	      $sump = 0.0;
787
	      PS_setfont($ps, $helvB, 10.0);
788
 
789
	      while ($adate <= $ldate) {
790
	         $x = CellPDF($ps, $sumperi[$per], $sumperp[$per], $x, $y, $lence, true);
791
	         $adate = IncDate($periode, $adate);
792
	         $sumi += $sumperi[$per];
793
	         $sump += $sumperp[$per];
794
	         $sumperi[$per] = 0.0;
795
	         $sumperp[$per] = 0.0;
796
	         $per++;
797
	      }
798
 
799
	      ZSumPDF($ps, $sumi, $sump, $x, $y, $lence);
800
	      $y -= 10;
801
	   }
802
 
803
	   $x = 40;
804
 
805
	   if ($y <= 30) {
806
	      PS_end_page($ps);
807
	      HeadLine($ps);
808
	      $y = $pheight - 30;
809
	   }
810
 
811
	   # Monatssummen und Gesamtzeitraumsumme am Ende der Tabelle
812
	   # anzeigen.
813
	   #
814
	   $len = PS_stringwidth($ps, GetMessage($db, 297, "Monatssummen: "));
815
	   $x = 38 + $csp - $len - 4;
816
	   PS_show_xy($ps, GetMessage($db, 297, "Monatssummen:"), $x, $y);
817
	   PS_rect($ps, 38, $y-1, $csp - 2, 10);
818
	   PS_stroke($ps);
819
	   $x = 38 + $csp;
820
	   $adate = $fdate;
821
	   $per = 0;
822
	   $sumi = 0.0;
823
	   $sump = 0.0;
824
	   PS_setfont($ps, $helvB, 10.0);
825
 
826
	   while ($adate <= $ldate) {
827
	      $x = CellPDF($ps, $totalis[$per], $totalpl[$per], $x, $y, $lence, true);
828
	      $adate = IncDate($periode, $adate);
829
	      $sumi += $totalis[$per];
830
	      $sump += $totalpl[$per];
831
	      $per++;
832
	   }
833
 
834
	   ZSumPDF($ps, $sumi, $sump, $x, $y, $lence);
835
	   $x = 40;
836
	   $y -= 20;
837
 
838
	   if ($y <= 30) {
839
	      PS_end_page($ps);
840
	      HeadLine($ps);
841
	      $y = $pheight - 30;
842
	   }
843
 
844
	   $pospr++;
845
	}
846
}
847
 
848
# Folgende Funktion erzeugt die Liste fuer genau einen Mitarbeiter. Die Liste
849
# sortiert nach Mitarbeitern und Projekten.
850
#
851
function MitarbeiterPjPDF($ps, $db, $mi_num, $ystart, $prp_num=0) {
852
	global $periode;
853
	global $phase;
854
	global $helvN;
855
	global $helvB;
856
	global $page;
857
	global $pwidth;
858
	global $pheight;
859
	global $SearchPath;
860
	global $fact;
861
 
862
	$dfrom = $_REQUEST['dfrom'];
863
	$dto = $_REQUEST['dto'];
864
	$fields_0 = $_REQUEST['fields_0'];
865
	$fields_1 = $_REQUEST['fields_1'];
866
	$fields_2 = $_REQUEST['fields_2'];
867
	$fields_3 = $_REQUEST['fields_3'];
868
	$fields_4 = $_REQUEST['fields_4'];
869
	$fields_5 = $_REQUEST['fields_5'];
870
	$fields_6 = $_REQUEST['fields_6'];
871
	$sort = $_REQUEST['sort'];
872
	$level = $_REQUEST['level'];
873
	$pjclosed = $_REQUEST['pjclosed'];
874
 
875
	if (isset($pjclosed) && CheckTrue($pjclosed))
876
	   $pjc = ",6";
877
 
878
	# Festlegen der Spaltenlaengen
879
	$lenpr = PS_stringwidth($ps, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
880
	$lenph = PS_stringwidth($ps, "9: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
881
	$lenta = $lenpr;
882
	$lenan = PS_stringwidth($ps, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
883
	$lence = PS_stringwidth($ps, "999,999");
884
	$lentotal = 0;
885
 
886
	# Beim bis-Datum den Monatsletzten ermitteln
887
	$mon = gmdate("n", $dto);
888
	$year = gmdate("Y", $dto);
889
	$day = daysinmonth($mon, $year);
890
	$dto = gmmktime(23, 59, 59, $mon, $day, $year);
891
	# Auslesen der Mitarbeiter. In einer Schleife werden die Daten
892
	# fuer jeden Mitarbeiter erstellt und pro Projekt angezeigt.
893
	#
894
	$query = "select mi_num, mi_nname, mi_vname, kl_land, ka_abt ";
895
	$query .= "from mitarbeiter, key_land, key_abt where ";
896
	$query .= "kl_num = mi_land and ka_num = mi_abt ";
897
 
898
	if ($mi_num > 0)
899
	   $query .= "and mi_num = $mi_num ";
900
 
901
	$query .= "order by mi_nname, mi_vname";
902
	$resmi = QueryDB($db, $query);
903
 
904
	if (!$resmi)
905
	   return;
906
 
907
	$nummi = numrowsDB($resmi);
908
	$posmi = 0;
909
 
910
	$pdiff = $fields_3;
911
	$pist = $fields_4;
912
	$pplan = $fields_5;
913
	$mult = 0;
914
	$y = $ystart;
915
	$x = 40;
916
 
917
	if ($pist > 0)
918
	   $mult++;
919
 
920
	if ($pplan > 0)
921
	   $mult++;
922
 
923
	if ($pplan > 0 && $pdiff > 0)
924
	   $mult++;
925
 
926
	# Errechnen der gesamten Laenge; Zu jeder Zelle wird ein Rand von
927
	# 2 PT gerechnet.
928
	#
929
	$lentotal = $lenpr + 4 + ($lence * $mult) + ($mult * 4);
930
	$csp = $lenpr + 4;
931
 
932
	if ($fields_6 > 0) {
933
	   $lentotal += ($lenph + 4);
934
	   $csp += ($lenph + 4);
935
	}
936
 
937
	if ($fields_0 > 0) {
938
	   $lentotal += ($lenta + 4);
939
	   $csp += ($lenta + 4);
940
	}
941
 
942
	if ($fields_1 > 0) {
943
	   $lentotal += ($lenan + 4);
944
	   $csp += ($lenan + 4);
945
	}
946
 
947
	# Die Anzahl der Perioden ergibt sich aus der Auswahl. Die
948
	# Mitarbeitersicht besteht aus einer einzigen Tabelle in der
949
	# alle Daten angezeigt werden und mit Zwischensummen versehen
950
	# werden.
951
	# In der folgenden Schleife wird die Anzahl der Perioden
952
	# ermittelt.
953
	#
954
	$adate = $dfrom;
955
	$numper = 0;
956
 
957
	while ($adate <= $dto) {
958
	   $adate = IncDate($periode, $adate);
959
	   $numper++;
960
	}
961
 
962
	$lentotal += (($numper * ($lence + 4)) * $mult);
963
	# Wenn die benoetigte Breite die zur Verfuegung stehende
964
	# ueberschreitet, dann skalieren wir die Ausgabe so, dass sich
965
	# alles in der Breite ausgeht.
966
	if ($lentotal > ($pwidth - 50)) {
967
	   $fact = ($pwidth - 50) / $lentotal;
968
	   PS_scale($ps, $fact, 1);
969
	}
970
 
971
	$TempTable = false;
972
 
973
	while ($posmi < $nummi) {
974
	   $data = fetchDB($resmi, $posmi);
975
	   $mi_num = $data[0];
976
	   $mi_nname = $data[1];
977
	   $mi_vname = $data[2];
978
	   $kl_land = $data[3];
979
	   $ka_abt = $data[4];
980
 
981
	   # Pruefen ob der Mitarbeiter in irgend einem Projekt im gewaehlten
982
	   # Zeitraum geplant ist.
983
	   if ($prp_num > 0) {
984
	      $query = "select count(*) from allocation, task, plan where ";
985
	      $query .= "ta_num = al_task and pl_num = ta_plnum and ";
986
	      $query .= "pl_prnum = $prp_num and pl_status in (0,2,3,4,5 $pjc) and ";
987
	   } else {
988
	      $query = "select count(*) from allocation, task, plan where ";
989
	      $query .= "ta_num = al_task and pl_num = ta_plnum and ";
990
	      $query .= "pl_status in (0,2,3,4,5 $pjc) and ";
991
	   }
992
 
993
	   $query .= "al_ressource = $mi_num and al_pstart between $dfrom and $dto";
994
	   $result = QueryDB($db, $query);
995
 
996
	   if (!$result)
997
	      return;
998
 
999
	   $data = fetchDB($result, 0);
1000
	   $anzp = $data[0];
1001
 
1002
	   # Pruefen ob es auch keine IST-Buchungen fuer den fraglichen
1003
	   # Zeitraum gegeben hat.
1004
	   $query = "select count(*) from wdone, plan where ";
1005
	   $query .= "pl_prnum = wd_prnum and pl_status in (0,2,3,4,5 $pjc) and ";
1006
	   $query .= "wd_datum between $dfrom and $dto and ";
1007
	   $query .= "wd_minum = $mi_num ";
1008
 
1009
	   if ($prp_num > 0)
1010
	      $query .= "and wd_prnum = $prp_num";
1011
 
1012
	   if (!($result = QueryDB($db, $query)))
1013
	      return;
1014
 
1015
	   $data = fetchDB($result, 0);
1016
	   $anzi = $data[0];
1017
 
1018
	   if ($anzp < 1 && $anzi < 1) {
1019
	      $posmi++;
1020
	      continue;
1021
	   }
1022
 
1023
	   # Zeichnen des Tabellenkopfs
1024
	   # Bei jedem Mitarbeiterwechsel wird ein neuer Tabellenkopf
1025
	   # gezeichnet.
1026
	   #
1027
	   if (($y - 60) <= 30) {
1028
	      PS_end_page($ps);
1029
	      HeadLine($ps);
1030
	      $y = $pheight - 30;
1031
	   }
1032
 
1033
	   $c = PS_stringwidth($ps, GetMessage($db, 55, "Abteilung:") . " ");
1034
	   PS_setfont($ps, $helvN, 10.0);
1035
	   PS_show_xy($ps, GetMessage($db, 298, "Name:"), $x, $y);
1036
	   PS_show_xy($ps, "$mi_nname $mi_vname", $x + $c, $y);
1037
	   $y -= 10;
1038
	   PS_show_xy($ps, GetMessage($db, 299, "Gruppe:"), $x, $y);
1039
	   PS_show_xy($ps, $kl_land, $x + $c, $y);
1040
	   $y -= 10;
1041
	   $lines = 2;
1042
 
1043
	   if (!$pmlight) {
1044
	      PS_show_xy($ps, GetMessage($db, 55, "Abteilung:"), $x, $y);
1045
	      PS_show_xy($ps, $ka_abt, $x + $c, $y);
1046
	      $y -= 10;
1047
	      $lines++;
1048
	   }
1049
 
1050
	   PS_rect($ps, $x - 2, $y + 9 , $lentotal, $lines * 10);
1051
	   PS_moveto($ps, $x - 2, $y + 10);
1052
	   PS_lineto($ps, $x - 2, $y - 2);
1053
	   PS_stroke($ps);
1054
	   $r = 0;
1055
	   $adate = $dfrom;
1056
	   $c = ($lence + 4) * $mult;
1057
	   $x = 38 + $csp;
1058
	   PS_setcolor($ps, "fill", "gray", 0.6, 0.0, 0.0, 0.0);
1059
	   PS_setfont($ps, $helvB, 10.0);
1060
 
1061
	   while ($r < $numper) {
1062
	      $p = gmdate("n/Y", $adate);
1063
	      PS_rect($ps, $x - 2, $y - 1, $c, 10);
1064
	      PS_fill($ps);
1065
	      PS_rect($ps, $x - 2, $y - 1, $c, 10);
1066
	      PS_stroke($ps);
1067
	      PS_show_boxed($ps, $p, $x, $y-2, $c - 4, 10, "center");
1068
	      $adate = IncDate($periode, $adate);
1069
	      $sumperp[$r] = 0.0;
1070
	      $sumperi[$r] = 0.0;
1071
	      $totalis[$r] = 0.0;
1072
	      $totalpl[$r] = 0.0;
1073
	      $mitotp[$r] = 0.0;
1074
	      $mitoti[$r] = 0.0;
1075
	      $r++;
1076
	      $x += $c;
1077
	   }
1078
 
1079
	   PS_rect($ps, $x - 2, $y - 1, $c, 10);
1080
	   PS_fill($ps);
1081
	   PS_rect($ps, $x - 2, $y - 1, $c, 10);
1082
	   PS_stroke($ps);
1083
	   PS_show_boxed($ps, GetMessage($db, 290, "Summen"), $x, $y-2, $c - 4, 10, "center");
1084
	   $y -= 10;
1085
	   $x = 40;
1086
	   PS_rect($ps, $x - 2, $y - 1, $lenpr+4, 10);
1087
	   PS_fill($ps);
1088
	   PS_rect($ps, $x - 2, $y - 1, $lenpr+4, 10);
1089
	   PS_stroke($ps);
1090
	   PS_show_boxed($ps, GetMessage($db, 277, "Projekt"), $x, $y-2, $lenpr, 10, "center");
1091
	   $x += $lenpr + 4;
1092
 
1093
	   if ($phase && $fields_6 > 0) {
1094
	      PS_rect($ps, $x - 2, $y - 1, $lenph+4, 10);
1095
	      PS_fill($ps);
1096
	      PS_rect($ps, $x - 2, $y - 1, $lenph+4, 10);
1097
	      PS_stroke($ps);
1098
	      PS_show_boxed($ps, GetMessage($db, 292, "Phase"), $x, $y-2, $lenph, 10, "center");
1099
	      $x += $lenph + 4;
1100
	   }
1101
 
1102
	   if ($fields_0 > 0) {
1103
	      PS_rect($ps, $x - 2, $y - 1, $lenta+4, 10);
1104
	      PS_fill($ps);
1105
	      PS_rect($ps, $x - 2, $y - 1, $lenta+4, 10);
1106
	      PS_stroke($ps);
1107
	      PS_show_boxed($ps, GetMessage($db, 293, "Tasks"), $x, $y-2, $lenta, 10, "center");
1108
	      $x += $lenta + 4;
1109
	   }
1110
 
1111
	   if ($fields_1 > 0) {
1112
	      PS_rect($ps, $x - 2, $y - 1, $lenan+4, 10);
1113
	      PS_fill($ps);
1114
	      PS_rect($ps, $x - 2, $y - 1, $lenan+4, 10);
1115
	      PS_stroke($ps);
1116
	      PS_show_boxed($ps, GetMessage($db, 294, "Anmerkungen"), $x, $y-2, $lenan, 10, "center");
1117
	      $x += $lenan + 4;
1118
	   }
1119
 
1120
	   $r = 0;
1121
 
1122
	   while ($r <= $numper) {
1123
	      if ($pist > 0) {
1124
	         PS_rect($ps, $x - 2, $y - 1, $lence+4, 10);
1125
	         PS_fill($ps);
1126
	         PS_rect($ps, $x - 2, $y - 1, $lence+4, 10);
1127
	         PS_stroke($ps);
1128
	         PS_show_boxed($ps, GetMessage($db, 279, "IST"), $x, $y-2, $lence, 10, "center");
1129
	         $x += $lence + 4;
1130
	      }
1131
 
1132
	      if ($pplan > 0 && $pdiff > 0) {
1133
	         PS_rect($ps, $x - 2, $y - 1, $lence+4, 10);
1134
	         PS_fill($ps);
1135
	         PS_rect($ps, $x - 2, $y - 1, $lence+4, 10);
1136
	         PS_stroke($ps);
1137
	         PS_show_boxed($ps, GetMessage($db, 295, "Diff."), $x, $y-2, $lence, 10, "center");
1138
	         $x += $lence + 4;
1139
	      }
1140
 
1141
	      if ($pplan > 0) {
1142
	         PS_rect($ps, $x - 2, $y - 1, $lence+4, 10);
1143
	         PS_fill($ps);
1144
	         PS_rect($ps, $x - 2, $y - 1, $lence+4, 10);
1145
	         PS_stroke($ps);
1146
	         PS_show_boxed($ps, GetMessage($db, 278, "Plan"), $x, $y-2, $lence, 10, "center");
1147
	         $x += $lence + 4;
1148
	      }
1149
 
1150
	      $r++;
1151
	   }
1152
 
1153
	   $y -= 10;
1154
	   $x = 40;
1155
	   PS_setcolor($ps, "fill", "gray", 1.0, 0.0, 0.0, 0.0);
1156
	   PS_setfont($ps, $helvN, 10.0);
1157
 
1158
	   # Projekte waehlen, in denen der Mitarbeiter geplant ist.
1159
	   #
1160
	   # Wurde kein bestimmter Mitarbeiter gewählt, werden immer alle
1161
	   # Mitarbeiter angezeigt. Es werden grundsätzlich alle Projekte
1162
	   # angezeigt in denen der Mitarbeiter geplant ist oder wo er
1163
	   # IST-Werte hat (das eine bedingt das andere!).
1164
	   #
1165
	   $query = "select distinct on (pr_num) pr_num, pr_name, pl_num, pl_status from ";
1166
	   $query .= "project, plan where pl_prnum = pr_num and pl_status in (0,2,3,4,5 $pjc) ";
1167
 
1168
	   if ($prp_num > 0)
1169
	      $query .= "and pr_num = $prp_num ";
1170
 
1171
	   $query .= "order by pr_num asc, pl_lfd desc";
1172
	   $respr = QueryDB($db, $query);
1173
 
1174
	   if (!$respr)
1175
	      return;
1176
 
1177
	   $numpr = numrowsDB($respr);
1178
	   $pospr = 0;
1179
	   $old_prnum = 0;
1180
	   $pr_flag = false;	// Zwischensumme schreiben
1181
 
1182
	   while ($pospr < $numpr) {
1183
	      $data = fetchDB($respr, $pospr);
1184
	      $pr_num = $data[0];
1185
	      $pr_name = $data[1];
1186
	      $pl_num = $data[2];
1187
	      $pl_status = $data[3];
1188
 
1189
	      # Pruefen ob fuer den fraglichen Zeitraum Plantage oder
1190
	      # IST-Daten vorhanden sind.
1191
	      $query = "select count(*) from allocation, task, plan where ";
1192
	      $query .= "ta_num = al_task and pl_num = ta_plnum and ";
1193
	      $query .= "pl_prnum = $pr_num and al_ressource = $mi_num and ";
1194
	      $query .= "al_pstart between $dfrom and $dto and pl_status in (0,2,3,4,5 $pjc)";
1195
 
1196
	      if (!($resco = QueryDB($db, $query)))
1197
	         return;
1198
 
1199
	      $data = fetchDB($resco, 0);
1200
	      $anzp = $data[0];
1201
 
1202
	      $query = "select count(*) from wdone where ";
1203
	      $query .= "wd_minum = $mi_num and wd_prnum = $pr_num and ";
1204
	      $query .= "wd_datum between $dfrom and $dto";
1205
 
1206
	      if (!($resco = QueryDB($db, $query)))
1207
	         return;
1208
 
1209
	      $data = fetchDB($resco, 0);
1210
	      $anzi = $data[0];
1211
 
1212
	      # Keine Plan- und IST-Daten? Wenn keine Daten, dann das
1213
	      # Projekt ueberspringen.
1214
	      if ($anzp == 0 && $anzi == 0) {
1215
	         $pospr++;
1216
	         continue;
1217
	      }
1218
 
1219
	      # Falls die temporaere Tabelle existiert, loeschen wir sie.
1220
	      if ($TempTable)
1221
		 TQueryDB($db, "drop table TempPlan");
1222
 
1223
	      $TempTable = true;
1224
 
1225
	      if (!CreateTempPlan($db, $pl_num, $pr_num, $dfrom, $dto, true, $mi_num, true)) {
1226
		 $pospr++;
1227
		 continue;
1228
	      }
1229
 
1230
	      # Wurden in der temporaeren Tabelle ueberhaupt Datensaetze
1231
	      # abgelegt?
1232
	      $query = "select count(*) from TempPlan";
1233
 
1234
	      if (!($resanz = QueryDB($db, $query)))
1235
	         return;
1236
 
1237
	      $data = fetchDB($resanz, 0);
1238
 
1239
	      if ($data[0] <= 0) {
1240
	         $pospr++;
1241
	         continue;
1242
	      }
1243
 
1244
	      $c = $csp + $np;
1245
	      $pr_flag = true;
1246
 
1247
	      # Tabelleninhalt schreiben:
1248
	      # Die Inhalte werden der zuvor temporaer erzeugten Tabelle
1249
	      # entnommen.
1250
	      #
1251
	      if ($fields_0 <= 0) {
1252
	         $query = "select sum(tmp_plan), sum(tmp_ist), tmp_periode ";
1253
 
1254
	         if ($fields_6 > 0)
1255
	            $query .= ", tmp_phase ";
1256
 
1257
	         $query .= "from TempPlan group by ";
1258
 
1259
	         if ($fields_6 > 0)
1260
	            $query .= "tmp_phase, ";
1261
 
1262
		 $query .= "tmp_periode order by ";
1263
 
1264
		 if ($fields_6 > 0)
1265
		    $query .= "tmp_phase, ";
1266
 
1267
		 $query .= "tmp_periode";
1268
	      } else {
1269
	         $query = "select tmp_phase, tmp_periode, tmp_plan, tmp_ist,";
1270
	         $query .= "tmp_taname, tmp_notiz, kp_phase, tmp_hash ";
1271
	         $query .= "from TempPlan, key_phase where ";
1272
	         $query .= "kp_num = tmp_phase ";
1273
	         $query .= "order by ";
1274
 
1275
	         if ($phase)
1276
	            $query .= "tmp_phase, ";
1277
 
1278
	         if ($fields_0 > 0 )
1279
	            $query .= "tmp_taname, ";
1280
 
1281
	         $query .= "tmp_periode";
1282
	      }
1283
 
1284
	      if (!($result = QueryDB($db, $query)))
1285
		 return;
1286
 
1287
	      $numrows = numrowsDB($result);
1288
	      $rows = 0;
1289
	      $oldphase = -1;
1290
	      $oldtask = "";
1291
	      $sumlpl = 0.0;
1292
	      $sumlis = 0.0;
1293
	      $per = 0;
1294
	      $first = true;
1295
	      $adate = $dfrom;
1296
	      $class = false;
1297
 
1298
	      while ($rows < $numrows) {
1299
		 $data = fetchDB($result, $rows);
1300
 
1301
		 if ($fields_0 > 0) {
1302
		    $tmp_phase = $data[0];
1303
		    $tmp_periode = $data[1];
1304
		    $tmp_plan = $data[2];
1305
		    $tmp_ist = $data[3];
1306
		    $tmp_taname = $data[4];
1307
		    $tmp_notiz = $data[5];
1308
		    $kp_phase = $data[6];
1309
		    $tmp_hash = $data[7];
1310
		 } else {
1311
		    $tmp_plan = $data[0];
1312
		    $tmp_ist = $data[1];
1313
		    $tmp_periode = $data[2];
1314
 
1315
		    if ($fields_6 > 0) {
1316
		       $tmp_phase = $data[3];
1317
 
1318
		       $query = "select kp_phase from key_phase where kp_num = $tmp_phase";
1319
 
1320
		       if (!($reskp = QueryDB($db, $query)))
1321
		          return;
1322
 
1323
		       if (numrowsDB($reskp) > 0) {
1324
		          $d = fetchDB($reskp, 0);
1325
			  $kp_phase = $d[0];
1326
		       } else
1327
		          $kp_phase = "";
1328
		    } else
1329
		       $tmp_phase = 0;
1330
 
1331
		    $tmp_taname = "";
1332
		    $tmp_notiz = "";
1333
		    $tmp_hash = "";
1334
		 }
1335
 
1336
		 # Summen und Zeilenanfang schreiben
1337
		 #
1338
		 if ($oldphase != $tmp_phase || $oldtask != $tmp_taname) {
1339
		    # Aktuelle Zeile vervollstaendigen (nur wenn eine Zeile
1340
		    # bereits geschrieben wurde).
1341
		    #
1342
		    if (!$first) {
1343
		       while ($adate <= $dto) {
1344
			  $x = CellPDF($ps, 0, 0, $x, $y, $lence, $class, true);
1345
			  $class = !$class;
1346
			  $adate = IncDate($periode, $adate);
1347
		       }
1348
 
1349
		       ZSumPDF($ps, $sumlis, $sumlpl, $x, $y, $lence);
1350
		       $x = 40;
1351
		       $y -= 10;
1352
 
1353
		       if ($y <= 30) {
1354
		          PS_end_page($ps);
1355
		          HeadLine($ps);
1356
		          $y = $pheight - 30;
1357
		       }
1358
		    }
1359
 
1360
		    # Beginn der Zeile: Schreiben der ersten fixen Zellen.
1361
		    #
1362
		    PS_show_xy($ps, "$pr_num $pr_name", $x, $y);
1363
		    PS_rect($ps, $x - 2, $y - 1, $lenpr+4, 10);
1364
		    PS_stroke($ps);
1365
		    $x += $lenpr + 2;
1366
 
1367
		    if ($phase && $fields_6 > 0) {
1368
		       PS_show_xy($ps, "$tmp_phase: $kp_phase", $x, $y);
1369
		       PS_rect($ps, $x - 2, $y - 1, $lenph+4, 10);
1370
		       PS_stroke($ps);
1371
		       $x += $lenph + 2;
1372
		    }
1373
 
1374
		    if ($fields_0 > 0) {
1375
		       PS_show_xy($ps, "$tmp_taname", $x, $y);
1376
		       PS_rect($ps, $x - 2, $y - 1, $lenta+4, 10);
1377
		       PS_stroke($ps);
1378
		       $x += $lenta + 2;
1379
		    }
1380
 
1381
		    if ($fields_1 > 0) {
1382
		       PS_show_xy($ps, "$tmp_notiz", $x, $y);
1383
		       PS_rect($ps, $x - 2, $y - 1, $lenan+4, 10);
1384
		       PS_stroke($ps);
1385
		       $x += $lenan + 2;
1386
		    }
1387
 
1388
		    # Variablen initialisieren...
1389
		    #
1390
		    $sumlis = 0.0;
1391
		    $sumlpl = 0.0;
1392
		    $per = 0;
1393
		    $adate = $dfrom;
1394
		    $oldphase = $tmp_phase;
1395
		    $oldtask = $tmp_taname;
1396
		    $first = false;
1397
		    $class = false;
1398
		    $x = 38 + $csp;
1399
		 }
1400
 
1401
		 # Stimmt die aktuelle Position nicht mit der Periode ueberein,
1402
		 # uebergehen wir die Zellen.
1403
		 #
1404
		 while ($adate < $tmp_periode) {
1405
		    $x = CellPDF($ps, 0, 0, $x, $y, $lence, $class, true);
1406
		    $class = !$class;
1407
		    $adate = IncDate($periode, $adate);
1408
		    $per++;
1409
	         }
1410
 
1411
	         # Schreiben einer Zelle mit den aktuellen Werten.
1412
	         $x = CellPDF($ps, $tmp_ist, $tmp_plan, $x, $y, $lence, $class, false);
1413
		 $class = !$class;
1414
	         $sumperp[$per] += $tmp_plan;
1415
	         $sumperi[$per] += $tmp_ist;
1416
	         $totalis[$per] += $tmp_ist;
1417
	         $totalpl[$per] += $tmp_plan;
1418
	         $mitoti[$per] += $tmp_ist;
1419
	         $mitotp[$per] += $tmp_plan;
1420
	         $sumlpl += $tmp_plan;
1421
	         $sumlis += $tmp_ist;
1422
	         $adate = IncDate($periode, $adate);
1423
	         $per++;
1424
	         $rows++;
1425
	      }
1426
 
1427
	      # Beenden der letzten Datenzeile der aktuellen Tabelle.
1428
	      #
1429
	      while ($adate <= $dto) {
1430
	         $x = CellPDF($ps, 0, 0, $x, $y, $lence, $class, true);
1431
		 $class = !$class;
1432
	         $adate = IncDate($periode, $adate);
1433
	      }
1434
 
1435
	      ZSumPDF($ps, $sumlis, $sumlpl, $x, $y, $lence);
1436
	      $x = 40;
1437
	      $y -= 10;
1438
 
1439
	      if ($y <= 30) {
1440
	         PS_end_page($ps);
1441
	         HeadLine($ps);
1442
	         $y = $pheight - 30;
1443
	      }
1444
 
1445
	      if ($prp_num == 0 && $numpr > 1 && ($fields_0 || $fields_6)) {
1446
	         PS_show_boxed($ps, GetMessage($db, 300, "Projektsumme:") . " ", $x, $y-2, $csp-4, 10, "right");
1447
	         PS_rect($ps, $x - 2, $y - 1, $csp, 10);
1448
	         PS_stroke($ps);
1449
	         $x = 38 + $csp;
1450
	         $adate = $dfrom;
1451
	         $per = 0;
1452
	         $sumi = 0.0;
1453
	         $sump = 0.0;
1454
 
1455
	         while ($adate <= $dto) {
1456
		    $x = CellPDF($ps, $sumperi[$per], $sumperp[$per], $x, $y, $lence, true);
1457
		    $adate = IncDate($periode, $adate);
1458
		    $sumi += $sumperi[$per];
1459
		    $sump += $sumperp[$per];
1460
		    $sumperi[$per] = 0.0;
1461
		    $sumperp[$per] = 0.0;
1462
		    $per++;
1463
	         }
1464
 
1465
	         ZsumPDF($ps, $sumi, $sump, $x, $y, $lence);
1466
		 $y -= 10;
1467
		 $x = 40;
1468
 
1469
	         if ($y <= 30) {
1470
	            PS_end_page($ps);
1471
	            HeadLine($ps);
1472
	            $y = $pheight - 30;
1473
	         }
1474
	      }
1475
 
1476
	      $pospr++;
1477
	   }
1478
 
1479
	   PS_show_boxed($ps, GetMessage($db, 301, "Gesamtsumme Mitarbeiter:") . " ", $x, $y-2, $csp-4, 10, "right");
1480
	   PS_rect($ps, $x - 2, $y - 1, $csp, 10);
1481
	   PS_stroke($ps);
1482
	   $x = 38 + $csp;
1483
	   $adate = $dfrom;
1484
	   $per = 0;
1485
	   $sumi = 0.0;
1486
	   $sump = 0.0;
1487
 
1488
	   while ($adate <= $dto) {
1489
	      $x = CellPDF($ps, $mitoti[$per], $mitotp[$per], $x, $y, $lence, true);
1490
	      $adate = IncDate($periode, $adate);
1491
	      $sumi += $mitoti[$per];
1492
	      $sump += $mitotp[$per];
1493
	      $mitoti[$per] = 0.0;
1494
	      $mitotp[$per] = 0.0;
1495
	      $per++;
1496
	   }
1497
 
1498
	   ZsumPDF($ps, $sumi, $sump, $x, $y, $lence);
1499
	   $y -= 15;
1500
	   $x = 40;
1501
 
1502
	   if ($y <= 30) {
1503
	      PS_end_page($ps);
1504
	      HeadLine($ps);
1505
	      $y = $pheight - 30;
1506
	   }
1507
 
1508
	   $posmi++;
1509
	}
1510
 
1511
	# Monatssummen und Gesamtzeitraumsumme am Ende der Tabelle
1512
	# anzeigen.
1513
	#
1514
	if ($mi_num == 0) {
1515
	   PS_show_boxed($ps, GetMessage($db, 297, "Monatssummen:") . " ", $x, $y-2, $csp-4, 10, "right");
1516
	   PS_rect($ps, $x - 2, $y - 1, $csp, 10);
1517
	   PS_stroke($ps);
1518
	   $x = 38 + $csp;
1519
	   $adate = $dfrom;
1520
	   $per = 0;
1521
	   $sumi = 0.0;
1522
	   $sump = 0.0;
1523
 
1524
	   while ($adate <= $dto) {
1525
	      $x = CellPDF($ps, $totalis[$per], $totalpl[$per], $x, $y, $lence, true);
1526
	      $adate = IncDate($periode, $adate);
1527
	      $sumi += $totalis[$per];
1528
	      $sump += $totalpl[$per];
1529
	      $per++;
1530
	   }
1531
 
1532
	   $x = ZsumPDF($ps, $sumi, $sump, $x, $y, $lence);
1533
	   $y -= 10;
1534
	   $x = 40;
1535
 
1536
	   if ($y <= 30) {
1537
	      PS_end_page($ps);
1538
	      HeadLine($ps);
1539
	      $y = $pheight - 30;
1540
	   }
1541
 
1542
	   $posmi++;
1543
	}
1544
}
1545
 
1546
function GetBrowserInfo($key) {
1547
	$browser = get_browser();
1548
 
1549
	while (list ($schl, $value) = each ($browser)) {
1550
	   if ($schl == $key)
1551
	      return $value;
1552
	}
1553
 
1554
	return "";
1555
}
1556
 
1557
# Folgende Funktion wertet die vom Anwender getroffenen Einstellungen aus
1558
# und ruft die entsprechenden Funktionen auf um die Listen darzustellen.
1559
#
1560
function PrintListPDF() {
1561
	global $phase;
1562
	global $pmlight;
1563
	global $strVersion;
1564
	global $helvN;
1565
	global $helvB;
1566
	global $page;
1567
	global $pwidth;
1568
	global $pheight;
1569
	global $SearchPath;
1570
 
1571
	$pl_num = $_REQUEST['pl_num'];
1572
	$mi_num = $_REQUEST['mi_num'];
1573
	$dfrom = $_REQUEST['dfrom'];
1574
	$dto = $_REQUEST['dto'];
1575
	$fields_0 = $_REQUEST['fields_0'];
1576
	$fields_1 = $_REQUEST['fields_1'];
1577
	$fields_2 = $_REQUEST['fields_2'];
1578
	$fields_3 = $_REQUEST['fields_3'];
1579
	$fields_4 = $_REQUEST['fields_4'];
1580
	$fields_5 = $_REQUEST['fields_5'];
1581
	$fields_6 = $_REQUEST['fields_6'];
1582
	$sort = $_REQUEST['sort'];
1583
	$level = $_REQUEST['level'];
1584
	$pjclosed = $_REQUEST['pjclosed'];
1585
 
1586
	# Als erstes pruefen wir, ob die wichtigen Parameter auch korrekt
1587
	# gesetzt wurden.
1588
	if ($dfrom > $dto) {
1589
	   Error(GetMessage(-1, 302, "Das Beginndatum darf nicht h&ouml;her sein als das Endedatum!"));
1590
	   return;
1591
	}
1592
 
1593
	$tmpfile = tempnam("/tmp", "pjtool");
1594
	unlink($tmpfile);
1595
	$tmpfileps = $tmpfile . ".ps";
1596
	$tmpfilepdf = $tmpfile . ".pdf";
1597
 
1598
	$db = OpenDB();
1599
	$ps = PS_new();
1600
 
1601
	if (PS_open_file($ps, $tmpfileps) == 0) {
1602
	   Error(GetMessage($db, 303, "Error: Konnte keine tempor&auml;re Postscriptdatei &ouml;ffnen!"));
1603
	   return;
1604
	}
1605
 
1606
	PS_set_info($ps, "Creator", "Theos Soft Project Manager v$strVersion");
1607
	PS_set_info($ps, "Author", "Andreas Theofilu");
1608
	PS_set_info($ps, "Title", "Auswertung");
1609
	PS_set_info($ps, "Keywords", "TheoSys, TheoPlan, Andreas, Theofilu, Auswertung, ProjectManager");
1610
	PS_set_info($ps, "BoundingBox", "0 0 $pheight $pwidth");
1611
	PS_set_info($ps, "Orientation", "Landscape");
1612
	PS_set_parameter($ps, "hyphenation", "false");
1613
	PS_set_parameter($ps, "warning", "false");
1614
	$helvN = PS_findfont($ps, "$SearchPath/phvr8a", "", "");
1615
	$helvB = PS_findfont($ps, "$SearchPath/phvb8a", "", "");
1616
 
1617
	$top = $pheight - 30;
1618
	$left = 40;
1619
	HeadLine($ps);		// print static head line
1620
 
1621
	# In einem ersten Schritt zeichnen wir eine Box in der die gewaehlten
1622
	# Parameter angezeigt werden:
1623
	#
1624
	PS_setfont($ps, $helvN, 10.0);
1625
	$len1 = PS_stringwidth($ps, GetMessage($db, 304, "Sortierreihenfolge:") . " ");
1626
	$chlen = GetMessage($db, 241, "Alle");
1627
	$y = $top;
1628
	$x = $left;
1629
	PS_set_text_pos($ps, $x, $y);
1630
	PS_show($ps, GetMessage($db, 1, "Projekt:"));
1631
	PS_set_text_pos($ps, $x + $len1, $y);
1632
 
1633
	if ($pl_num == 0) {
1634
	   PS_show($ps, GetMessage($db, 241, "Alle"));
1635
	} else {
1636
	   $query = "select pl_prnum, pr_name from plan, project ";
1637
	   $query .= "where pr_num = pl_prnum and pl_num = $pl_num";
1638
	   $result = QueryDB($db, $query);
1639
 
1640
	   if (!$result) {
1641
	      closeDB($db);
1642
	      return;
1643
	   }
1644
 
1645
	   $data = fetchDB($result, 0);
1646
	   $pr_num = $data[0];
1647
	   $pr_name = $data[1];
1648
	   PS_show($ps, "$pr_num $pr_name");
1649
	   if (strlen("$pr_num $pr_name") > strlen($chlen))
1650
	      $chlen = "$pr_num $pr_name";
1651
	}
1652
 
1653
	$y -= 10;
1654
	PS_set_text_pos($ps, $x, $y);
1655
	PS_show($ps, GetMessage($db, 305, "Mitarbeiter:"));
1656
	PS_set_text_pos($ps, $x + $len1, $y);
1657
 
1658
	if ($mi_num == 0) {
1659
	   PS_show($ps, GetMessage($db, 241, "Alle"));
1660
	} else {
1661
	   $query = "select mi_nname, mi_vname from mitarbeiter where mi_num = $mi_num";
1662
	   $result = QueryDB($db, $query);
1663
 
1664
	   if (!$result) {
1665
	      closeDB($db);
1666
	      return;
1667
	   }
1668
 
1669
	   $data = fetchDB($result, 0);
1670
	   $mi_nname = $data[0];
1671
	   $mi_vname = $data[1];
1672
	   PS_show($ps, "$mi_nname $mi_vname");
1673
	   if (strlen("$mi_nname $mi_vname") > strlen($chlen))
1674
	      $chlen = "$mi_nname $mi_vname";
1675
	}
1676
 
1677
	$y -= 10;
1678
	PS_set_text_pos($ps, $x, $y);
1679
	PS_show($ps, GetMessage($db, 306, "Zeitraum:"));
1680
	PS_set_text_pos($ps, $x + $len1, $y);
1681
	$text = GetMessage($db, 307, "Von:") . " " . date("n.Y", $dfrom) . " ";
1682
	$text .= GetMessage($db, 308, "Bis:") . " " . date("n.Y", $dto);
1683
	PS_show($ps, $text);
1684
 
1685
	if (strlen($text) > strlen($chlen))
1686
	   $chlen = $text;
1687
 
1688
	$y -= 10;
1689
	PS_set_text_pos($ps, $x, $y);
1690
	PS_show($ps, GetMessage($db, 309, "Spaltenauswahl:"));
1691
	PS_set_text_pos($ps, $x + $len1, $y);
1692
 
1693
	if ($fields_2 > 0) {
1694
	   PS_show($ps, GetMessage($db, 291, "Gruppe"));
1695
	   $y -= 10;
1696
	   PS_set_text_pos($ps, $x + $len1, $y);
1697
	}
1698
 
1699
	if ($fields_6 > 0) {
1700
	   PS_show($ps, GetMessage($db, 206, "Phasen"));
1701
	   $y -= 10;
1702
	   PS_set_text_pos($ps, $x + $len1, $y);
1703
	}
1704
 
1705
	if ($fields_0 > 0) {
1706
	   PS_show($ps, GetMessage($db, 310, "Tasks anzeigen"));
1707
	   $y -= 10;
1708
	   PS_set_text_pos($ps, $x + $len1, $y);
1709
	}
1710
 
1711
	if ($fields_1 > 0) {
1712
	   PS_show($ps, GetMessage($db, 294, "Anmerkungen"));
1713
	   $y -= 10;
1714
	   PS_set_text_pos($ps, $x + $len1, $y);
1715
	}
1716
 
1717
	if ($fields_4 > 0) {
1718
	   PS_show($ps, GetMessage($db, 311, "IST-Werte"));
1719
	   $y -= 10;
1720
	   PS_set_text_pos($ps, $x + $len1, $y);
1721
	}
1722
 
1723
	if ($fields_3 > 0) {
1724
	   PS_show($ps, GetMessage($db, 312, "IST- / Plandifferenz"));
1725
	   $y -= 10;
1726
	   PS_set_text_pos($ps, $x + $len1, $y);
1727
	}
1728
 
1729
	if ($fields_5 > 0) {
1730
	   PS_show($ps, GetMessage($db, 313, "Planwerte"));
1731
	   $y -= 10;
1732
	   PS_set_text_pos($ps, $x + $len1, $y);
1733
	}
1734
 
1735
	PS_set_text_pos($ps, $x, $y);
1736
	ps_show($ps, GetMessage($db, 304, "Sortierreihenfolge:"));
1737
	PS_set_text_pos($ps, $x + $len1, $y);
1738
 
1739
	if ($sort == 1)
1740
	   PS_show($ps, GetMessage($db, 314, "Projekte / Mitarbeiter"));
1741
	else
1742
	   PS_show($ps, GetMessage($db, 315, "Mitarbeiter / Projekte"));
1743
 
1744
/*	$y -= 10;
1745
	PS_set_text_pos($ps, $x, $y);
1746
	PS_show($ps, "Plantiefe:");
1747
	PS_set_text_pos($ps, $x + $len1, $y);
1748
 
1749
	if ($level == -1)
1750
	   PS_show($ps, "Alle");
1751
	else
1752
	   PS_show($ps, "Bis zu Level $level");
1753
*/
1754
	$len2 = PS_stringwidth($ps, $chlen);
1755
	PS_setlinewidth($ps, 0.4);
1756
	PS_moveto($ps, $x - 4, $y - 4);
1757
	PS_rect($ps, $x - 4, $y - 4, $len1 + $len2 + 8, $top - $y + 14);
1758
	PS_stroke($ps);
1759
	$y -= 14;
1760
 
1761
	if ($sort == 1)
1762
	   ProjektMaPDF($ps, $db, $pr_num, $y, $mi_num);
1763
	else
1764
	   MitarbeiterPjPDF($ps, $db, $mi_num, $y, $pr_num);
1765
 
1766
	PS_end_page($ps);
1767
	PS_close($ps);
1768
	PS_delete($ps);
1769
	passthru("/usr/bin/ps2pdf -sPAPERSIZE=a4 $tmpfileps $tmpfilepdf");
1770
	closeDB($db);
1771
	unlink($tmpfileps);
1772
	$len = filesize($tmpfilepdf);
1773
	$browser = GetBrowserInfo("browser");
1774
 
1775
	if ($browser == "IE") {		// workaround for braindead browser!
1776
	   header("Pragma: public");
1777
	   header("Expires: 0");
1778
	   header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
1779
	   header("Content-type: application/pdf");
1780
//	   header("Content-Length: $len");
1781
	   header("Content-Disposition: attachment; filename=\"auswertung.pdf\"");
1782
	} else {
1783
	   header("Content-type: application/pdf");
1784
	   header("Content-Length: $len");
1785
	   header("Content-Disposition: inline; filename=\"auswertung.pdf\"");
1786
	}
1787
 
1788
	readfile($tmpfilepdf);
1789
	unlink($tmpfilepdf);
1790
}
1791
 
1792
# Auswertung der Funktionen
1793
if ($func == "prlist") {
1794
   $pl_num = $_REQUEST['pl_num'];
1795
   $mi_num = $_REQUEST['mi_num'];
1796
   $dfrom = $_REQUEST['dfrom'];
1797
   $dto = $_REQUEST['dto'];
1798
   $fields_0 = $_REQUEST['fields_0'];
1799
   $fields_1 = $_REQUEST['fields_1'];
1800
   $fields_2 = $_REQUEST['fields_2'];
1801
   $fields_3 = $_REQUEST['fields_3'];
1802
   $fields_4 = $_REQUEST['fields_4'];
1803
   $fields_5 = $_REQUEST['fields_5'];
1804
   $fields_6 = $_REQUEST['fields_6'];
1805
   $sort = $_REQUEST['sort'];
1806
   $level = $_REQUEST['level'];
1807
 
1808
   PrintListPDF();
1809
}
1810
 
1811
if ($func == "pauswertung") {
1812
   PrintListPDF();
1813
}
1814
 
1815
//require('footer.inc');
1816
?>