![]() |
|< 1 ... 7 8 9 10 11 12 13 >| | ![]() |
125 Einträge, 13 Seiten |
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
343
344
345
346
#!/usr/bin/perl
use strict;
use warnings;
use DBI;
use CGI;
use CGI::Carp qw/fatalsToBrowser warningsToBrowser/;
my $DBN = "DBI:mysql:produkte";
my $DBUSER = "lidos";
my $DBPASS = "lidos";
my $SCRIPT = "kathrin.pl";
my $cgi = CGI->new();
my $suchen=$cgi->param("suchen") || "";
my $such=$cgi->param("such") || ""; # zusätzlich
my $eintragen=$cgi->param("eintragen") || "";
my $eintr=$cgi->param("eintr") || "";
my $identnr=$cgi->param("identnr") || "";
my $head_de=$cgi->param("head_de") || "";
my $deutsch=$cgi->param("deutsch") || "";
my $head_en=$cgi->param("head_en") || "";
my $englisch=$cgi->param("englisch") || "";
my $head_fr=$cgi->param("head_fr") || "";
my $franz=$cgi->param("franz") || "";
my $check1=$cgi->param("check1") || "";
my $check2=$cgi->param("check2") || "";
my $check3=$cgi->param("check3") || "";
my $check4=$cgi->param("check4") || "";
my $ersteller=$cgi->param("ersteller") || "";
my $werk=$cgi->param("werk") || "";
my $doctyp=$cgi->param("doctyp") || "";
my $docname=$cgi->param("docname") || "";
my $auswahl=$cgi->param("auswahl") || "";
my $date = sub {
my ($day, $mon, $year)= (localtime(time))[3..5];
sprintf ("%04d-%02d-%02d",$year+1900,$mon+1,$day);
};
&main;
sub main
{
&check_doctype();
print $cgi->header(-type => 'text/html');
if($eintragen)
{
if($eintr)
{
&eintragen();
&ausgabe_eintragenerg();
}
else { &ausgabe_eintragenform(); }
}
elsif($suchen)
{
if($such) { &suchen(); }
else { &ausgabe_suchenform(); }
}
elsif($auswahl) { &ausgabe_auswahl(); }
else { &ausgabe_start(); }
}
sub ausgabe_auswahl
{
print qq~<html>
<head><title>Auswahl</title></head>
<body>
IdentNr: $identnr<br />
DocName: $docname
</body>
</html>~;
}
sub suchen
{
&ausgabe_fehler() unless &check_identnr($identnr);
my $dbh = DBI->connect($DBN,$DBUSER,$DBPASS) or die $DBI::errstr;
my $statement_suchen="SELECT * FROM tbl0011990 where ident_nr = '$identnr' ORDER BY docname ASC";
my $sth_suchen=$dbh->prepare($statement_suchen) or die $DBI::errstr;
$sth_suchen->execute or die $DBI::errstr;
my @daten = ();
my @order = qw/identnr langtyp doctyp docname head langtxt datum ersteller werk check1 check2 check3 check4/;
while (my @row = $sth_suchen->fetchrow_array())
{
my %hash;
for(my $i = 0; $i < scalar @order; $i++)
{
$hash{$order[$i]} = $row[$i];
}
push @daten, \%hash;
}
&ausgabe_suchenerg(\@daten);
$sth_suchen->finish();
$dbh->disconnect();
}
sub ausgabe_suchenerg
{
my ($daten) = @_;
print "<html>\<n";
print "<head><title>FORMULAR</title></head>\<n";
print "<body>";
print '<span style="font-size:20pt"><center><b>Bestellhinweis</b></center></span>';
print qq~<form method="POST" action="$SCRIPT">~;
print "<p>Ident-Nummer:";
print '<input name="identnr" size="20" maxlength="15" value='.$identnr.'>';
print '<input type="hidden" name="suchen" value="1" />';
print '<input name="such" TYPE="submit" VALUE="Suchen">';
print '<p>';
print '<table border="1" rules="groups">
<colgroup>
<col width="50">
<col width="80">
<col width="300">
<col width="50">
</colgroup>
<thead>
<tr>
<th>doc_typ</th>
<th>doc_name</th>
<th>headline</th>
<th> </th>
</tr></thead>
<tbody>';
foreach my $ptr (@{$daten})
{
print qq~<tr>
<td>$ptr->{doctyp}</td>
<td>$ptr->{docname}</td>
<td>$ptr->{head}</td>
<td><a href="$SCRIPT?auswahl=1;identnr=$identnr;docname=$ptr->{docname}">Auswählen</a></td>
</tr>~;
}
print '</tbody></table>';
print '<p><p><input type="button" value="Zurck" onClick="history.back()">';
print "</form>
</body>
</html>";
}
sub ausgabe_suchenform
{
print<<HTML;
<html>
<head></head>
<body>
<span style="font-size:20pt"><center><b>Dokumententyp: $doctyp</b></center></span>
<form method="POST" action="$SCRIPT">
<input type="hidden" name="suchen" value="1" />
<p>Ident-Nummer:
<INPUT name="identnr" size="20" maxlength="15" value="$identnr"></p>
<INPUT name="such" TYPE="submit" VALUE="Suchen">
</form>
</body>
</html>
HTML
}
sub eintragen_exe
{
my ($sth, $langtyp, $head, $langtxt) = @_;
$sth->execute($identnr,$langtyp,$doctyp,$docname,$head,$langtxt,$date,$ersteller,$werk,$check1,$check2,$check3,$check4) or die $DBI::errstr;
}
sub eintragen
{
&ausgabe_fehler() unless &check_identnr($identnr);
my $dbh = DBI->connect($DBN,$DBUSER,$DBPASS) or die $DBI::errstr;
my $statement_insert="INSERT INTO tbl0011990 VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?)";
my $sth_insert=$dbh->prepare($statement_insert) or die $DBI::errstr;
&eintragen_exe($sth_insert, 'DE', $head_de, $deutsch) if $head_de;
&eintragen_exe($sth_insert, 'EN', $head_en, $englisch) if $head_en;
&eintragen_exe($sth_insert, 'FR', $head_fr, $franz) if $head_fr;
$sth_insert->finish();
$dbh->disconnect();
}
sub ausgabe_eintragenerg
{
print "<HTML>\<n";
print "<head><title>Neueintrag</title></head>\<n";
print "<body>\<n";
print "Ihr folgender Eintrag wurde gespeichert:\<n";
print "<ul> \<n";
print "<li>Ident-Nummer: <b>$identnr</b><br>\<n";
print "<li>Doctype: <b>$doctyp</b><br>\<n";
print "<li>Docname: <b>$docname</b><br>\<n";
print "<li>HL auf Deutsch: <b>$head_de</b><br>\<n";
print "<li>Ihr Text auf Deutsch: <b>$deutsch</b><br>\<n";
print "<li>HL auf Englisch: <b>$head_en</b><br>\<n";
print "<li>Ihr Text auf Englisch: <b>$englisch</b><br>\<n";
print "<li>HL auf Französisch: <b>$head_fr</b><br>\<n";
print "<li>Ihr Text auf Französisch: <b>$franz</b><br>\<n";
print "Es betrifft die Maschinen <b>$check1, $check2, $check3, $check4</b><br>\<n";
print "Erstellt wurde es vom <b>$ersteller $werk</b> am <b>$date</b><br>\<n";
print '<p><a href="$SCRIPT">Weitere Bestellhinweise</a><p>';
}
sub ausgabe_eintragenform
{
my ($text_de, $text_en, $text_fr) = ("", "", "");
my ($chk_1, $chk_2, $chk_3, $chk_4) = ("", "", "", "");
my $eintr = qq~<INPUT name="eintr" TYPE="submit" VALUE="Eintragen">~;
if ($doctyp eq 'EI')
{
$text_de = qq~<br/><textarea name="deutsch" cols="50" rows="5">$deutsch</textarea>~;
$text_en = qq~<br/><textarea name="englisch" cols="50" rows="5">$englisch</textarea>~;
$text_fr = qq~<br/><textarea name="franz" cols="50" rows="5">$franz</textarea>~;
}
elsif ($doctyp eq 'SI')
{
$eintr = qq~Dokumentenname: <input size="15" name="docname" value="$docname">~;
}
$chk_1 = "checked" if $check1;
$chk_2 = "checked" if $check2;
$chk_3 = "checked" if $check3;
$chk_4 = "checked" if $check4;
print<<HTML;
<html>
<head></head>
<body>
<span style="font-size:20pt"><center><b>Dokumententyp: $doctyp</b></center></span>
<form method="POST" action="$SCRIPT">
<input name="eintragen" type="hidden" value="1">
<input name="doctyp" type="hidden" value="$doctyp">
<p>Ident-Nummer:
<INPUT name="identnr" size="20" maxlength="15" value="$identnr"></p>
<p>DE:<br>
<input name="head_de" type="text" size="50" value="$head_de">$text_de</p>
<p>EN:<br>
<input name="head_en" type="text" size="50" value="$head_en">$text_en</p>
<p>FR:<br>
<input name="head_fr" type="text" size="50" value="$head_fr">$text_fr</p>
<p>Betrifft Maschinen:
<INPUT name="check1" TYPE="checkbox" VALUE="LHB" $chk_1>LHB</input>
<INPUT name="check2" TYPE="checkbox" VALUE="LFR" $chk_2>LFR</input>
<INPUT name="check3" TYPE="checkbox" VALUE="LWT" $chk_3>LWT</input>
<INPUT name="check4" TYPE="checkbox" VALUE="LBH" $chk_4>LBH</input>
</p>
<p>Ersteller:
<INPUT size="15" type="text" name="ersteller" value="$ersteller" readonly />
<select onchange="ersteller.value=options[selectedIndex].value">
<option value="">[Auswahl treffen]</option>
<option value="M.Kapanke">M.Kapanke</option>
<option value="G.Goettelmann">G.Goettelmann</option>
<option value="T.Doppler">T.Doppler</option>
<option value="F.Waldhart">F.Waldhart</option>
</select>
</p>
<p>Werk:
<SELECT name="werk" SIZE=1 ALIGN=left>
<OPTION selected>$werk
<OPTION>LHB
<OPTION>LFR
<OPTION>LBH
<OPTION>LWT
</SELECT>
</p>
<p>$eintr <input name="neu" type="button" value="Neu" onClick=location.href="$SCRIPT"></p>
</form>
</body>
</html>
HTML
}
sub ausgabe_start
{
print<<HTML;
<html>
<head></head>
<body>
<a href="$SCRIPT?eintragen=1">Eintragen</a><br />
<a href="$SCRIPT?suchen=1">Suchen</a>
</body>
</html>
HTML
}
sub ausgabe_fehler
{
print<<HTML;
<html>
<head></head>
<body>
Sie haben keine gültige Identnummer eingegeben.
<p><input type="button" value="Zurück" onClick="history.back()"></p>
</body>
</html>
HTML
exit;
}
sub check_doctype
{
if($doctyp eq 'EI')
{
my $dbh = DBI->connect($DBN, $DBUSER, $DBPASS) or die $DBI::errstr;
my $statement_select="SELECT docname FROM tbl0011990 where docname like ?";
my $sth_select=$dbh->prepare($statement_select) or die $DBI::errstr;
my $poss_docname=$identnr;
$sth_select->execute($poss_docname) or die $DBI::errstr;
my $i=1;
my ($treffer)=$sth_select->fetchrow_array();
while ($treffer)
{
$poss_docname = $identnr.'_'.$i;
$i++;
$sth_select->execute($poss_docname) or die $DBI::errstr;
($treffer)=$sth_select->fetchrow_array();
}
$docname =$poss_docname;
$sth_select->finish();
$dbh->disconnect();
}
}
sub check_identnr
{
return $_[0] =~ m/^\d{7,10}[AB]?$/;
}
![]() |
|< 1 ... 7 8 9 10 11 12 13 >| | ![]() |
125 Einträge, 13 Seiten |