-
Notifications
You must be signed in to change notification settings - Fork 0
/
printtasks.php
342 lines (272 loc) · 9.62 KB
/
printtasks.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
<?php
$units=0.00476;//μετατροπη απο ανθρωποημερες σε ανθρωποετη
function CalcFortos($a,$b)
{
$tot=0;$sub=0;
/*
$mon=array(1,0.125,0.0021); // 1/60/8=0.0021 1/8=0.125
*/
$mon=array(1,0.166,0.00277); // 1/60/6=0.00277 1/6=0.166
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("tasks") or die(mysql_error());
mysql_query("set character_set_client=utf8");
mysql_query("set character_set_connection=utf8");
mysql_query("set collation_connection=utf8");
mysql_query("set character_set_results=utf8");
$sql = "SELECT * FROM tasks where taskid=".$a;
$data = mysql_query($sql)
or die(mysql_error());
while($info = mysql_fetch_array( $data ))
{
for ($z=1;$z<=7;$z++)
{
if ($info['Y'.$z]==$b)
{
//calc subtotal for task for eidikotita
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("tasks") or die(mysql_error());
mysql_query("set character_set_client=utf8");
mysql_query("set character_set_connection=utf8");
mysql_query("set collation_connection=utf8");
mysql_query("set character_set_results=utf8");
$sql1 = "SELECT syxnotita,monada, Y".$z." as TOT FROM actions where taskid=".$a;
$data1 = mysql_query($sql1)
or die(mysql_error());
//$sub=0;
while($info1 = mysql_fetch_array( $data1 ))
{
$syxnotita=$info1['syxnotita'];
$monada=$info1['monada'];
$tot=$info1['TOT'];
$sub=$sub+$syxnotita*$tot*$mon[$monada];
}
}
}
}
return $sub;
}
function SELECTGD($inf)
{
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("tasks") or die(mysql_error());
mysql_query("set character_set_client=utf8");
mysql_query("set character_set_connection=utf8");
mysql_query("set collation_connection=utf8");
mysql_query("set character_set_results=utf8");
$data = mysql_query("SELECT * FROM gd")
or die(mysql_error());
print "<select name=gdieythinsi disabled>";
$x=0;
while($info = mysql_fetch_array( $data ))
{
$x++;
print "<option ";
if($info['id']==$inf) print " SELECTED ";
PRINT "VALUE='".$info['id']."'>".$info['gdieythinsi'];
print "</OPTION>";
}
PRINT" </select>";
};
function SELECTDIEYTHINSI($inf)
{
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("tasks") or die(mysql_error());
mysql_query("set character_set_client=utf8");
mysql_query("set character_set_connection=utf8");
mysql_query("set collation_connection=utf8");
mysql_query("set character_set_results=utf8");
$data = mysql_query("SELECT * FROM dieythinsi order by dieythinsi")
or die(mysql_error());
print "<select name=dieythinsi disabled>";
while($info = mysql_fetch_array( $data ))
{
print "<option ";
if($info['id']==$inf) print " SELECTED ";
PRINT "VALUE='".$info['id']."'>".$info['dieythinsi'];
print "</OPTION>";
}
PRINT" </select>";
};
function SELECTCOMPLETED($inf)
{
print "<select name=completed disabled>";
print "<option ";
if($inf==0) print " SELECTED ";
PRINT "VALUE=0>ΟΧΙ</OPTION>";
print "<option ";
if($inf==1) print " SELECTED ";
PRINT "VALUE=1>ΝΑΙ</OPTION>";
print "<option ";
if($inf==2) print " SELECTED ";
PRINT "VALUE=2>ΠΡΟΣ ΔΙΑΓΡΑΦΗ</OPTION>";
PRINT" </select>";
};
function SELECTEIDIKOTHTA($col,$inf)
{
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("tasks") or die(mysql_error());
mysql_query("set character_set_client=utf8");
mysql_query("set character_set_connection=utf8");
mysql_query("set collation_connection=utf8");
mysql_query("set character_set_results=utf8");
$data = mysql_query("SELECT * FROM EIDIKOTHTA order by EIDIKOTHTA")
or die(mysql_error());
print "<select name=Y".$col." disabled>";
while($info = mysql_fetch_array( $data ))
{
print "<option ";
if($info['ID']==$inf) print " SELECTED ";
PRINT "VALUE='".$info['ID']."'>".$info['EIDIKOTHTA'];
print "</OPTION>";
}
PRINT" </select>";
};
function SELECTTMIMA($inf)
{
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("tasks") or die(mysql_error());
mysql_query("set character_set_client=utf8");
mysql_query("set character_set_connection=utf8");
mysql_query("set collation_connection=utf8");
mysql_query("set character_set_results=utf8");
$data = mysql_query("SELECT * FROM tmima order by tmima")
or die(mysql_error());
print "<select name=tmima disabled>";
while($info = mysql_fetch_array( $data ))
{
print "<option ";
if($info['id']==$inf) print " SELECTED ";
PRINT "VALUE='".$info['id']."'>".$info['tmima'];
print "</OPTION>";
}
PRINT" </select>";
};
function SELECTMONADA($row,$info1)
{
$mon=array("ΜΕΡΕΣ","ΩΡΕΣ","ΛΕΠΤΑ");
print "<select name=monada".$row." disabled>";
for ($x=0;$x<=2;$x++)
{
print "<option ";
if($info1==$x) print " SELECTED ";
PRINT "VALUE='".$x."'>".$mon[$x];
print "</OPTION>";
}
print "</select>";
}
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("tasks") or die(mysql_error());
mysql_query("set character_set_client=utf8");
mysql_query("set character_set_connection=utf8");
mysql_query("set collation_connection=utf8");
mysql_query("set character_set_results=utf8");
$taskid=0;
if (isset($_REQUEST['taskid'])) $taskid=$_REQUEST['taskid'];
$sql = "SELECT * FROM tasks where taskid=".$taskid;
$data = mysql_query($sql)
or die(mysql_error());
/*
if (mysql_num_rows($sql)==0)
{
$sql="INSERT INTO tasks (diadikasia) VALUES ('ΝΕΑ ΔΙΑΔΙΚΑΣΙΑ')";
$data = mysql_query($sql)
or die(mysql_error());
$sql = "SELECT * FROM tasks where taskid=".$taskid;
$data = mysql_query($sql)
or die(mysql_error());
}
*/
;
PRINT "<h2> ΔΙΑΔΙΚΑΣΙΑ #".$taskid;
PRINT "</H2>";
PRINT "<HR>";
print "<form id=forma action=# method=post>";
PRINT "<input name=taskid type=hidden value=".$taskid."></td>";
while($info = mysql_fetch_array( $data ))
{
//print "ΓΕΝΙΚΗ ΔΙΕΥΘΥΝΣΗ:<input type=text id=inputfield1 name=gdieythinsi value='".$info['gdieythinsi']."'><BR>";
PRINT "<H2>ΜΕΡΟΣ Α</H2>";
print "ΓΕΝΙΚΗ ΔΙΕΥΘΥΝΣΗ:";SELECTGD($info['gdieythinsi']);print "<br>";
print "ΔΙΕΥΘΥΝΣΗ:";SELECTDIEYTHINSI($info['dieythinsi']);print "<br>";
print "ΤΜΗΜΑ:";SELECTTMIMA($info['tmima']);print "<br>";
print "ΑΡΜΟΔΙΟΤΗΤΑ:<input type=text id=inputfield4 name=armodiotita value='".$info['armodiotita']."' size=100 disabled><BR>";
print "ΔΙΑΔΙΚΑΣΙΑ:<input type=text id=inputfield5 name=diadikasia value='".$info['diadikasia']."' size=100 disabled><BR>";
print "Η ΚΑΤΑΧΩΡΗΣΗ ΕΧΕΙ ΟΛΟΚΛΗΡΩΘΕΙ; ";SELECTCOMPLETED($info['completed']);
print "<br>ΠΑΡΑΤΗΡΗΣΕΙΣ:<br>";
print"<textarea rows=2 cols=100 name=paratiriseis disabled>";
print $info['paratiriseis'];
print "</textarea>";
PRINT "<H2>ΜΕΡΟΣ B</H2>";
print "<table><tr><td>α/α</td><td>ΕΝΕΡΓΕΙΑ</td><td>ΕΠΙΘΥΜΗΤΕΣ<BR> ΔΙΕΚΠΕΡΑΙΩΣΕΙΣ/ΕΤΟΣ</td><td>ΔΙΕΚΠΕΡΑΙΩΣΕΙΣ/ΕΤΟΣ</td><td>ΜΟΝΑΔΑ ΧΡΟΝΟΥ</td>";
for ($y=1;$y<=7;$y++)
{
PRINT "<TD size=2> Κ".$y."</td>";
$k[$y]=$info['Y'.$y];
}
PRINT "</tr>";
}
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("tasks") or die(mysql_error());
mysql_query("set character_set_client=utf8");
mysql_query("set character_set_connection=utf8");
mysql_query("set collation_connection=utf8");
mysql_query("set character_set_results=utf8");
$sql = "SELECT * FROM actions where taskid=".$taskid." order by actionid";
$data = mysql_query($sql)
or die(mysql_error());
$x=0;
while($info = mysql_fetch_array( $data ))
{
$x++;
if (($x%2)==0) print "<TR>";
if (($x%2)!=0) print "<TR bgcolor=lightgrey>";
print "<td>".$x."</td>";
print"<td><textarea rows=2 cols=60 name=energeia".$x." disabled>";
print $info['energeia'];
print "</textarea></td>";
PRINT "<TD><input name=stoxos".$x." value='".$info['stoxos']."' disabled></td>";
PRINT "<TD><input name=syxnotita".$x." value='".$info['syxnotita']."' disabled></td>";
PRINT "<TD>";SELECTMONADA($x,$info['monada']);print "</td>";
for ($y=1;$y<=7;$y++)
{
PRINT "<TD size=5>".$info['Y'.$y]."</td>";
}
print "</tr>";
}
//if (mysql_num_rows($data)==0)
//{
$z=$x+1;
for ($x=$z;$x<=20;$x++)
{
if (($x%2)==0) print "<TR>";
if (($x%2)!=0) print "<TR bgcolor=lightgrey>";
print "<td>".$x."</td>";
print"<td><textarea rows=2 cols=60 name=energeia".$x." disabled>";
print $info['energeia'];
print "</textarea></td>";
PRINT "<TD><input name=stoxos".$x." value='".$info['stoxos']."' disabled></td>";
PRINT "<TD><input name=syxnotita".$x." value='".$info['syxnotita']."' disabled></td>";
PRINT "<TD>";SELECTMONADA($x,$info['monada']);print "</td>";
for ($y=1;$y<=7;$y++)
{
PRINT "<TD>".$info['Y'.$y]."</td>";
}
print "</tr>";
}
//}
print "</table>";
print "<table>";
print "<TR><TD>ΕΙΔΙΚΟΤΗΤΑ</TD><td align=center>ΦΟΡΤΟΣ<BR>(ΑΝΘΡΩΠΟΕΤΗ)</TD></TR>";
$sum=0;
for ($y=1;$y<=7;$y++)
{
$CF=CalcFortos($taskid,$k[$y])*$units;
PRINT "<TR><TD>K".$y;SELECTEIDIKOTHTA($y,$k[$y]);print "</td><td align=right>".$CF."</td></TR>";
$sum=$sum+$CF;
}
print "<TR><td>ΣΥΝΟΛΟ</TD><TD align=right>".$sum."</td></tr>";
print "</table>";
//print "<INPUT TYPE=SUBMIT VALUE='ΑΠΟΘΗΚΕΥΣΗ'>" ;
print "</form>";
?>