· 8 years ago · Aug 11, 2018, 06:26 AM
1<html>
2<head><link rel="stylesheet" type="text/css" href="style.css" />
3
4<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
5
6<SCRIPT language=JavaScript>
7function reload(form){
8var val=form.cat.options[form.cat.options.selectedIndex].value;
9self.location='insert_form.php?cat=' + val ;
10}
11</script>
12
13<script language=JavaScript >
14function sumemp()
15{
16 var newtext=0;
17 for(var i=0;i<7;i++)
18 {
19 var temp=form1.employees[i].value;
20 if(isNaN(temp) )
21 {newtext=newtext;}
22 else
23 {
24
25 newtext=newtext +parseInt(form1.employees[i].value);
26 }
27 }
28 form1.totalemployees.value = newtext;
29}
30
31</script>
32
33
34
35<script language=JavaScript >
36function sumexpenses()
37{
38 var newtext=0;
39
40 for(var i=0;i<7;i++)
41 {
42
43 var temp=form1.expenses[i].value;
44 if(isNaN(temp))
45 {newtext=newtext;}
46 else
47 {
48 newtext=newtext +parseInt(form1.expenses[i].value);
49 }
50 }
51
52 form1.totalexpenses.value = newtext;
53}
54
55
56</script>
57
58
59
60
61<script language=JavaScript >
62function dokimastiko()
63{
64
65
66
67
68 var temp=form1.field[41].value;
69
70
71 form1.expenses[0].value=temp;
72}
73
74
75</script>
76
77
78</head>
79<body>
80
81
82<?php
83/////////////////////// Check if cat is numeric and if it exists
84
85$cat=$_GET['cat'];
86 if(strlen($cat) > 0 and !is_numeric($cat)){//check if $cat is numeric data or not.
87echo "Data Error";
88exit;
89}
90
91
92
93
94////////////////////Create connection
95
96$con = mysql_connect("localhost:3306","root","D1ONYS1A20");
97if (!$con)
98 {
99 die('Could not connect: ' . mysql_error());
100 echo "skata";
101 }
102 else
103 {
104
105 mysql_select_db("misthodosia",$con);
106
107 }
108 ////////////////////////////////////////////////////////////////
109
110$eidos_ota=mysql_query('SELECT * FROM EIDOS_OTA');
111$afora=mysql_query('SELECT * FROM AFORA');
112 /////////////////////////////////////////////////////////////////////////////
113
114
115
116
117
118
119echo "<form name='form1' action='insert.php' method='post'>";
120
121echo"<table id='table1'>";
122echo "<tr>";
123 echo"<td>";
124/////////////////////////////////////////////////////////////////////////////////////////////////////////
125
126
127/////////////////////////////////////// create table stoixeia forea
128 echo"<table>";
129 echo"<tr>";
130 echo"<td><b>Στοιχεία ΦοÏÎα</b></td>";
131 echo"<td></td>";
132 echo "</tr>";
133 echo"<tr>";
134 echo"<td>Είδος ΟΤΑ:</td>";
135 echo"<td><select name='cat' onchange='reload(this.form)'>";
136
137 while ($row1=mysql_fetch_array($eidos_ota))
138 {
139
140 if ($row1['id']==@$cat)
141 {
142 echo "<option selected value=".$row1['id'].">".$row1['eidos']."</option>";
143
144 }
145 else
146 {
147
148 echo "<option value=".$row1['id'].">".$row1['eidos']."</option>";
149
150 }
151
152
153
154
155 }
156 echo "</select></td>";
157
158
159
160 echo "</tr>";
161
162
163 echo"<tr>";
164 echo"<td>Όνομα ΟΤΑ:</td>";
165 echo"<td>";
166
167 echo"<select name='onoma_ota'>";
168
169 if (isset($cat) and strlen($cat) > 0 and $cat==0 )
170
171 {
172
173 $onomata_ota=mysql_query("SELECT * from ota_b");
174
175 while ($row2=mysql_fetch_array($onomata_ota))
176 {
177 echo "<option value=".$row2['KOD_NOM']." >" . $row2['NOMARXIA'] . "</option>";
178 }
179
180 }
181
182
183 elseif (isset($cat) and strlen($cat) > 0 and $cat==1)
184 {
185
186
187 $onomata_ota=mysql_query("SELECT ota_a.KOD_DHM, ota_a.ONOMA_OTA, ota_b.NOMARXIA from ota_a,ota_b where ota_a.KOD_NOM=ota_b.KOD_NOM ORDER BY ONOMA_OTA");
188
189 while ($row2=mysql_fetch_array($onomata_ota))
190 {
191
192 echo "<option value=".$row2['KOD_DHM']." >" . $row2['ONOMA_OTA']." | ".$row2['NOMARXIA'] ."";
193 }
194
195
196
197
198 }
199
200 else
201 {
202 $onomata_ota=mysql_query("SELECT * from ota_b");
203
204 while ($row2=mysql_fetch_array($onomata_ota))
205 {
206 echo "<option value=".$row2['KOD_NOM']." >" . $row2['NOMARXIA'] . "</option>";
207 }
208
209
210 }
211
212
213
214
215
216 echo "</select></td>";
217
218
219
220 echo "</tr>";
221 echo"<tr>";
222 echo"<td>ΑφοÏά:</td>";
223 echo"<td><select name='afora'>";
224
225 while ($row1=mysql_fetch_array($afora))
226 {
227 echo "<option value=".$row1['id'].">".$row1['afora']."</option>";
228 }
229 echo"</select><td>";
230 echo "</tr>";
231 echo"<tr>";
232 echo"<td>Πλήθος ÎΠΔΔ:</td>";
233 echo"<td><input type='text' name='plhthos'></input></td>";
234 echo "</tr>";
235echo"</table>";
236
237//////////////////////////////////////////////////////////////////////
238
239
240 echo"</td>";
241
242 //////////////////////////////////////////////////////////////////////////////////////////////////////
243 echo"<td>";
244
245
246
247 //////////////////////////////////////////////////////////////////////////////////////////////////////
248 echo"<table>";
249 echo "<tr>";
250 echo"<td>";
251 //////////////create table stoixeia ypeythinou
252
253 echo"<table class='pinakes'>";
254 echo"<tr>";
255 echo"<td><b>Στοιχεία ΥπευθÏνου</b></td>";
256 echo"<td></td>";
257 echo "</tr>";
258 echo"<tr>";
259 echo"<td>Ονοματεπώνυμο:</td>";
260 echo"<td><input type='text' name='ypeythinos'></input></td>";
261 echo "</tr>";
262 echo"<tr>";
263 echo"<td>ΤηλÎφωνο:</td>";
264 echo"<td><input type='text' name='thlefwno_ypeythinou'></input></td>";
265 echo "</tr>";
266 echo"<tr>";
267 echo"<td><b>ΗμεÏομηνία:</b></td>";
268 echo"<td></td>";
269 echo "</tr>";
270
271 echo"<tr>";
272 echo"<td>Μήνας:</td>";
273 echo"<td><select name='mhnes'>";
274 $mhnes=mysql_query("Select * from mhnes");
275 while ($row1=mysql_fetch_array($mhnes))
276 {
277 echo "<option value=".$row1['perigrafi'].">".$row1['perigrafi']."</option>";
278 }
279 echo"</select><td>";
280 echo "</tr>";
281 echo"<tr>";
282 echo"<td>ΗμεÏομηνία:</td>";
283 echo"<td><input type='text' name='date'></input></td>";
284 echo "</tr>";
285
286echo"</table>";
287 ///////////////////////////////////////////////
288 echo"</td>";
289 echo"</tr>";
290
291
292
293 echo "<tr>";
294 echo"<td>";
295///////////////////////////////////////////////////////////////////////////
296
297 echo"<td>";
298 echo"</tr>";
299 echo "</table>";
300
301
302
303 echo"</td>";
304 ////////////////////////////////////////////////////////////////////////////////////////////
305
306
307 echo"<td>";
308 ////////////////////create table stoixeia xeiristh
309 echo"<table>";
310 echo"<tr>";
311 echo"<td><b>Στοιχεία ΧειÏιστή</b></td>";
312
313 echo "</tr>";
314
315 echo"<tr>";
316 echo"<td>Όνομα ΧειÏιστή:</td>";
317
318
319 echo"<td><input type='text' disabled='disabled'></input></td>";
320 echo "</tr>";
321
322echo"</table>";
323 ///////////////////////////////////////////////////////////////////////
324
325 echo"</td>";
326 echo "</tr>";
327 echo"</table>";
328
329
330
331
332
333
334
335
336
337
338
339
340
341 //////////////create expenses table
342
343 $i=0;
344 $j=0;
345 $employeecategories=array("α.Μόνιμοι","β.ΙΔΑΧ","γ.ΙΔΟΧ","δ.ΣÏμβαση ΈÏγου","ε.ΔικηγόÏοι με</br> Έμμισθη Εντολή","στ.STAGE","ζ.Αμοιβόμενοι με </br> ειδικά μισθολόγια ");
346 $expensecategories=array("1.Βασικός μισθός","2.ΧÏονοεπίδομα","3.ΣÏνολο επιδομάτων","4.ΥπεÏωÏίες","5.Αποζημίωση Συλλ. ΟÏγαν","6.ΕÏγοδοτικÎÏ‚ εισφοÏÎÏ‚");
347
348 echo"<table>";
349 echo "<tr>";
350 echo"<td><b>ΜΗÎΙΑΙΑ ΔΑΠΑÎΗ MΙΘΟΔΟΣΙΑΣ</b></td>";
351 for ($i=0;$i<7;$i++)
352 {
353 echo "<td><b>".$employeecategories[$i]."</b></td>";
354
355
356 }
357 echo "</tr>";
358
359
360 $counter=0;
361
362
363for ($i=0;$i<6;$i++)
364{
365 echo"<tr>";
366 echo "<td>".$expensecategories[$i].":</td>";
367
368 for ($j=0;$j<7;$j++)
369 {
370 echo "<td><input type='text' name='field[$counter]' onchange='dokimastiko();'/></td>";
371 $counter++;
372 }
373
374 echo "</tr>";
375}
376echo"<tr id='emptyline1'></tr>";
377echo "<tr>";
378echo "<td><b>ΑΡΙΘΜΟΣ ΥΠΑΛΛΗΛΩÎ</b></td>";
379
380for ($j=0;$j<7;$j++)
381 {
382 echo "<td><input type='text' name='employees' onChange='sumemp();' /></td>";
383
384 }
385
386echo "</tr>";
387echo"<tr id='emptyline2'></tr>";
388echo "<tr>";
389echo "<td><b>ΣΥÎΟΛΟ ΔΑΠΑÎΩΠ(1-6)</b></td>";
390for ($j=0;$j<7;$j++)
391 {
392 echo "<td><input type='text' name='expenses' onChange='sumexpenses();'/></td>";
393 $counter++;
394 }
395
396echo "</tr>";
397
398echo "<tr>";
399echo "<td><b>ΓΕÎΙΚΟ ΣΥÎΟΛΟ ΔΑΠΑÎΩΠ(α-στ)</b></td>";
400echo "<td><input type='text' name='totalexpenses' readonly/></td>";
401$counter++;
402for ($j=0;$j<6;$j++)
403 {
404 echo "<td></td>";
405
406 }
407
408echo "</tr>";
409
410echo "<tr>";
411echo "<td><b>ΣΥÎΟΛΙΚΟΣ ΑΡΙΘΜΟΣ ΥΠΑΛ(α-στ)</b></td>";
412echo "<b><td><input type='text' name='totalemployees' readonly/></td></b>";
413$counter++;
414for ($j=0;$j<6;$j++)
415 {
416 echo "<td></td>";
417
418 }
419
420echo "</tr>";
421
422
423
424echo"</table>";
425
426
427///////////////////////////// end of expenses table
428echo "<input type='submit' name='Submit' value='ΚαταχώÏηση εγγÏαφής' ></input>";
429
430
431echo"</form>";
432
433
434 ?>
435 </br></br>
436
437
438
439
440
441
442 </body></html>