Subversion Repositories public

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4 andreas 1
<?php
2
$dbx = OpenDB();
3
// Die Taskliste ausgeben
4
$zeit = time() + 7 * 86400;
5
$queryx = "select ca_prnum, ca_date, ca_title, ca_status, ca_num, ca_end,";
6
$queryx .= "mi_nname, mi_vname, ca_priority from calendar ";
7
$queryx .= "left join mitarbeiter on mi_num = ca_minum ";
8
$queryx .= "where ca_date <= $zeit and ca_status > 0 and ";
9
$queryx .= "(ca_minum = $unum or ca_minum is null or ca_minum < 1 ";
10
$queryx .= "or ca_writer = $unum) order by ca_priority desc, ca_end asc";
11
 
12
if (!($resultx = QueryDB($dbx, $queryx))) {
13
   closeDB($dbx);
14
   exit ();
15
}
16
 
17
$nr = numrowsDB($resultx);
18
 
19
if ($nr > 0) {
20
   $old_prnum = 0;
21
   $old_date = 0;
22
   $izaehl = 0;
23
   $opFirst = 0;
24
   $odFirst = 0;
25
   $j = 0;
26
   echo "<table class=\"sel\" width=\"70%\">\n";
27
   echo "<tr><th colspan=5 class=\"sel\">";
28
   Output($dbx, 267, "Zu erledigende Aufgaben und allgemeine Mitteilungen");
29
   echo "</th></tr>\n";
30
   echo "<tr><th class=\"sel\" align=\"center\" valign=\"top\" width=\"15%\">";
31
   Output($dbx, 268, "Datum");
32
   echo "</th>";
33
   echo "<th class=\"sel\" align=\"center\" width=\"15%\">";
34
   Output($dbx, 269, "Zu erl. bis");
35
   echo "</th>";
36
   echo "<th class=\"sel\" align=\"center\" valign=\"top\" width=\"5%\">";
37
   Output($dbx, 270, "Prio.");
38
   echo "</th>";
39
   echo "<th class=\"sel\" align=\"center\" valign=\"top\" width=\"25%\">";
40
   Output($dbx, 271, "f&uuml;r Mitarbeiter");
41
   echo "</th>";
42
   echo "<th class=\"sel\" align=\"center\" valign=\"top\" width=\"40%\">";
43
   Output($dbx, 272, "[Pr.Nr.] offene Aufgaben / Titel");
44
   echo "</th></tr>\n";
45
 
46
   while ($izaehl < $nr) {
47
      $data = fetchDB($resultx, $izaehl);
48
      $ca_prnum = $data[0];
49
      $ca_date = $data[1];
50
      $ca_title = $data[2];
51
      $ca_status = $data[3];
52
      $ca_num = $data[4];
53
      $ca_end = $data[5];
54
      $mi_vname = $data[6];
55
      $mi_nname = $data[7];
56
      $ca_priority = $data[8];
57
 
58
      if ($old_prnum != $ca_prnum || !$opFirst) {
59
         if ($opFirst) {
60
	    $a = 0;
61
 
62
	    while ($a < $j) {
63
	       echo $name[$a] . "<br>\n";
64
	       $a++;
65
	    }
66
 
67
	    echo "</td><td class=\"sel\" width=\"40%\">";
68
	    $a = 0;
69
 
70
	    while ($a < $j) {
71
	       echo $task[$a] . "<br>\n";
72
	       $a++;
73
	    }
74
 
75
	    echo "</td></tr>\n";
76
	    $j = 0;
77
	 }
78
 
79
//	 if (isset($ca_prnum) && $ca_prnum > 0)
80
//	    echo "<tr><td colspan=4 class=\"nwb\">$ca_prnum</td></tr>\n";
81
//	 else
82
//	    echo "<tr><td colspan=4 class=\"nwb\">Keine Zuordnung</td></tr>\n";
83
 
84
	 echo "<tr><td class=\"sel\" width=\"15%\" valign=\"top\">" . gmdate("j.m.Y", $ca_date) . "</td>\n";
85
 
86
	 if (isset($ca_end)) {
87
	    if (($ca_end + 86400) < time())
88
	       echo "<td class=\"sel\" width=\"15%\" valign=\"top\"><font color=\"a00000\"><b>" . gmdate("j.m.Y", $ca_end) . "</b></font></td>\n";
89
	    else if ($ca_end < time())
90
	       echo "<td class=\"sel\" width=\"15%\" valign=\"top\"><b>" . gmdate("j.m.Y", $ca_end) . "</b></td>\n";
91
	    else
92
	       echo "<td class=\"sel\" width=\"15%\" valign=\"top\">" . gmdate("j.m.Y", $ca_end) . "</td>\n";
93
	 }
94
	 else
95
	    echo "<td class=\"sel\" width=\"15%\" align=\"center\" valign=\"top\"> - </td>\n";
96
 
97
	 echo "<td width=\"5%\" ";
98
 
99
	 if ($ca_priority == 0)
100
	    echo "class=\"one\">" . GetMessage($dbx, 273, "Nieder") . "</td>";
101
 
102
	 if ($ca_priority == 1)
103
	    echo ">" . GetMessage($dbx, 274, "Normal") . "</td>";
104
 
105
	 if ($ca_priority == 2)
106
	    echo "class=\"five\"><b>" . GetMessage($dbx, 275, "Hoch") . "</b></td>";
107
 
108
	 echo "<td class=\"sel\" width=\"25%\">";
109
	 $old_date = $ca_date;
110
	 $old_prnum = $ca_prnum;
111
	 $opFirst = 1;
112
	 $odFirst = 1;
113
      }
114
 
115
      if ($old_date != $ca_date || !$odFirst) {
116
	 if ($odFirst) {
117
	    $a = 0;
118
 
119
	    while ($a < $j) {
120
	       echo $name[$a] . "<br>\n";
121
	       $a++;
122
	    }
123
 
124
	    echo "</td><td class=\"sel\" width=\"40%\">";
125
	    $a = 0;
126
 
127
	    while ($a < $j) {
128
	       echo $task[$a] . "<br>\n";
129
	       $a++;
130
	    }
131
 
132
	    echo "</td></tr>\n";
133
	    $j = 0;
134
	 }
135
 
136
	 echo "<tr><td class=\"sel\" width=\"15%\" valign=\"top\">" . gmdate("j.m.Y", $ca_date) . "</td>\n";
137
 
138
	 if (isset($ca_end))
139
	    if (($ca_end + 86400) < time())
140
	       echo "<td class=\"sel\" width=\"15%\" valign=\"top\"><font color=\"a00000\"><b>" . gmdate("j.m.Y", $ca_end) . "</b></font></td>\n";
141
	    else if ($ca_end < time())
142
	       echo "<td class=\"sel\" width=\"15%\" valign=\"top\"><b>" . gmdate("j.m.Y", $ca_end) . "</b></td>\n";
143
	    else
144
	       echo "<td class=\"sel\" width=\"15%\" valign=\"top\">" . gmdate("j.m.Y", $ca_end) . "</td>\n";
145
	 else
146
	    echo "<td class=\"sel\" width=\"15%\" align=\"center\" valign=\"top\"> - </td>\n";
147
 
148
	 echo "<td width=\"5%\" ";
149
 
150
	 if ($ca_priority == 0)
151
	    echo "class=\"one\">" . GetMessage($dbx, 273, "Nieder") . "</td>";
152
 
153
	 if ($ca_priority == 1)
154
	    echo ">" . GetMessage($dbx, 274, "Normal") . "</td>";
155
 
156
	 if ($ca_priority == 2)
157
	    echo "class=\"five\"><b>" . GetMessage($dbx, 275, "Hoch") . "</b></td>";
158
 
159
	 echo "<td class=\"sel\" width=\"25%\">";
160
	 $old_date = $ca_date;
161
	 $odFirst = 1;
162
      }
163
 
164
      $year = gmdate("Y", $ca_date);
165
      $month = gmdate("m", $ca_date);
166
      $today = gmdate("j", $ca_date);
167
 
168
      if (isset($mi_nname))
169
         $name[$j] = $mi_nname . " " . $mi_vname;
170
      else
171
         $name[$j] = " - ";
172
 
173
      $task[$j] = "[$ca_prnum] <a href=\"#\" onClick=\"javascript:open_window('appt.php?year=$year&month=$month&today=$today&id=$ca_num&header=1&menu=0','Kalender',800,600)\">$ca_title</a>";
174
      $j++;
175
      $izaehl++;
176
   }
177
 
178
   if ($j > 0) {
179
      $a = 0;
180
 
181
      while ($a < $j) {
182
	 echo $name[$a] . "<br>\n";
183
	 $a++;
184
      }
185
 
186
      echo "</td><td class=\"sel\" width=\"40%\">";
187
      $a = 0;
188
 
189
      while ($a < $j) {
190
	 echo $task[$a] . "<br>\n";
191
	 $a++;
192
      }
193
 
194
      echo "</td></tr>\n";
195
   }
196
 
197
   echo "</table>\n";
198
 
199
   if ($rstufe != 1)
200
      echo "<br><br><br><br>\n";
201
}
202
 
203
// Einige Statistiken anzeigen
204
if ($unum > 0) {
205
   $queryx = "select mi_nname, mi_vname from mitarbeiter where mi_num = $unum";
206
 
207
   if (!($resultx = QueryDB($dbx, $queryx))) {
208
      closeDB($dbx);
209
      exit();
210
   }
211
 
212
   $datax = fetchDB($resultx, 0);
213
   $mi_nname = $datax[0];
214
   $mi_vname = $datax[1];
215
   $queryx = "select distinct on (pr_num) pr_num, pr_name, pr_pl from project, plan, task, allocation where ";
216
   $queryx .= "pl_prnum = pr_num and ta_plnum = pl_num and al_task = ta_num and ";
217
   $queryx .= "pl_status in (2,3,4) and al_ressource = $unum order by pr_num";
218
 
219
   if (!($resultx = QueryDB($dbx, $queryx))) {
220
      closeDB($dbx);
221
      exit();
222
   }
223
 
224
   $nrx = numrowsDB($resultx);
225
} else
226
   $nrx = 0;
227
 
228
if ($nrx > 0) {
229
   if ($nr > 0)
230
      echo "<br>\n";
231
?>
232
<table class="sel">
233
   <tr>
234
      <th class="sel" colspan=5><? Output($dbx, 276, "Aufw&auml;nde in PT pro Projekt f&uuml;r"); ?> <? echo "$mi_nname $mi_vname"; ?></th>
235
   </tr>
236
   <tr>
237
      <th class="sel"><? Output($dbx, 277, "Projekt"); ?></th>
238
      <th class="sel"><? Output($dbx, 278, "Plan"); ?></th>
239
      <th class="sel"><? Output($dbx, 279, "IST"); ?></th>
240
<?
241
      if ($ist_erledigung) { ?>
242
      <th class="sel"><? Output($dbx, 280, "Erl. Zeit"); ?></th>
243
<?
244
      } ?>
245
      <th class="sel"><? Output($dbx, 281, "Erl. Arb."); ?></th>
246
   </tr>
247
<?
248
}
249
   $x = 0;
250
 
251
   while ($x < $nrx) {
252
      $datax = fetchDB($resultx, $x);
253
      $pr_num = $datax[0];
254
      $pr_name = $datax[1];
255
      $pr_pl = $datax[2];
256
 
257
      # Sicherstellen, dass das gewaehlte Projekt nicht abgeschlossen ist.
258
      $queryx = "select count(*) from plan where pl_prnum = $pr_num and pl_status = 6";
259
 
260
      if (!($res = QueryDB($dbx, $queryx))) {
261
         closeDB($db);
262
         exit();
263
      }
264
 
265
      $datax = fetchDB($res, 0);
266
 
267
      if ($datax[0] > 0) {
268
         $x++;
269
         continue;
270
      }
271
 
272
      $queryx = "select pl_num, pl_status from plan ";
273
      $queryx .= "where pl_prnum = $pr_num and pl_status in (2,3,4) ";
274
      $queryx .= "order by pl_lfd desc, pl_status desc";
275
 
276
      if (!($resplx = QueryDB($dbx, $queryx))) {
277
         closeDB($dbx);
278
         exit();
279
      }
280
 
281
      if (numrowsDB($resplx) > 0) {
282
         $datax = fetchDB($resplx, 0);
283
         $pl_num = $datax[0];
284
         $pl_status = $datax[1];
285
      } else {
286
         $x++;
287
         continue;
288
      }
289
 
290
      $queryx = "select sum(al_hours) from task, allocation where ";
291
      $queryx .= "al_task = ta_num and ta_plnum = $pl_num and al_ressource = $unum";
292
 
293
      if (!($resalx = QueryDB($dbx, $queryx))) {
294
         closeDB($dbx);
295
         exit();
296
      }
297
 
298
      $datax = fetchDB($resalx, 0);
299
      $al_hours = $datax[0];
300
 
301
      $queryx = "select sum(wd_hours)/$leneinheit from wdone where ";
302
      $queryx .= "wd_prnum = $pr_num and wd_minum = $unum";
303
 
304
      if (!($reswdx = QueryDB($dbx, $queryx))) {
305
         closeDB($dbx);
306
         exit();
307
      }
308
 
309
      $datax = fetchDB($reswdx, 0);
310
      $wd_hours = $datax[0];
311
      echo "<tr><td class=\"sel\">$pr_num $pr_name</td>\n";
312
 
313
      if (($unum == $pr_pl || $rstufe == 1) && $pl_status == 2 && $shortcuts) {
314
	 echo "<td class=\"selnum\"><a href=\"#\" ";
315
	 echo "onClick=\"javascript:MoveTo('plan.php','menu=2&headline=9&";
316
	 echo "editplan=$pl_num')\">";
317
	 echo FormatNum($al_hours, 3);
318
	 echo "</a></td>\n";
319
      } else
320
	 printf("<td class=\"selnum\">%s</td>\n", FormatNum($al_hours, 3));
321
 
322
      if ($rstufe >= 1 && $rstufe <= 3 && $shortcuts) {
323
	 echo "<td class=\"selnum\"><a href=\"#\" ";
324
 
325
	 if ($pmlight)
326
	    echo "onClick=\"javascript:MoveTo('istpm.php','menu=1&mitarbeiter=$unum&project=$pr_num')\">";
327
	 else
328
	    echo "onClick=\"javascript:MoveTo('ist.php','menu=1&mitarbeiter=$unum&project=$pr_num')\">";
329
 
330
	 echo FormatNum($wd_hours, 3);
331
	 echo "</a></td>\n";
332
      } else
333
	 printf("<td class=\"selnum\">%s</td>\n", FormatNum($wd_hours, 3));
334
 
335
      if ($al_hours == 0)
336
	 $proz = 0.0;
337
      else
338
	 $proz = $wd_hours / $al_hours * 100.0;
339
 
340
      if ($proz > 100)
341
	 printf("<td class=\"five\" align=\"right\">%s%%</td>\n", FormatNum($proz, 1));
342
      else
343
	 printf("<td class=\"selnum\">%s%%</td>\n", FormatNum($proz, 1));
344
 
345
      # Ermitteln der bisher geleisteten Arbeit (Annaeherung!)
346
      if ($ist_erledigung) {
347
	 $queryx = "select sum(ta_complete) from task where ta_plnum = $pl_num";
348
 
349
	 if (!($resx = QueryDB($dbx, $queryx))) {
350
	    closeDB($dbx);
351
	    exit();
352
	 }
353
 
354
	 $datax = fetchDB($resx, 0);
355
	 $sump = $datax[0];
356
	 $queryx = "select count(*) from task where ta_plnum = $pl_num";
357
 
358
	 if (!($resx = QueryDB($dbx, $queryx))) {
359
	    closeDB($dbx);
360
	    exit();
361
	 }
362
 
363
	 $datax = fetchDB($resx, 0);
364
	 $sanz = $datax[0];
365
	 $proz = $sump / $sanz;
366
	 printf("<td class=\"selnum\">%s%%</td></tr>\n", FormatNum($proz, 1));
367
      } else
368
	 echo "</tr>\n";
369
 
370
      $x++;
371
   }
372
 
373
if (nrx > 0)
374
   echo "</table>\n";
375
 
376
 
377
closeDB($dbx);
378
unset($queryx);
379
unset($resultx);
380
unset($datax);
381
?>