-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUnit4.pas
165 lines (151 loc) · 3.83 KB
/
Unit4.pas
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
unit Unit4;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Buttons,
Vcl.Imaging.jpeg, Vcl.ExtCtrls;
type
TForm4 = class(TForm)
Label1: TLabel;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
btnKembali: TBitBtn;
BitBtn1: TBitBtn;
Image1: TImage;
Image2: TImage;
Image3: TImage;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
procedure SpeedButton1Click(Sender: TObject);
procedure btnKembaliClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form4: TForm4;
implementation
uses
Unit2,Unit3,Unit5,Unit6;
{$R *.dfm}
procedure TForm4.btnKembaliClick(Sender: TObject);
begin
Hide;
Form3.Show;
Form6.Memo1.Lines.Clear;
end;
procedure TForm4.SpeedButton1Click(Sender: TObject);
var
s, s2, s3,jenisPrinter,ink,laser,dot : string;
tag, i : Integer;
begin
DM2.Pertanyaan_zq.Open;
DM2.Pertanyaan_zq.First;
tag:=(Sender AS TSpeedButton).Tag;
s:='P000';
with Form6.Memo1.Lines do begin
Clear;
if tag = 0 then begin
jenisPrinter:='Ink Jet';
s:=s+(tag+1).ToString;
ink:='YP0001';
laser:='NP0002';
dot:='NP0003';
DM2.Pertanyaan_zq.Next;
DM2.Pertanyaan_zq.Next;
DM2.Pertanyaan_zq.Next;
end
else if tag = 1 then begin
DM2.Pertanyaan_zq.Next;
jenisPrinter:='Laser Jet';
s:=s+(tag+2).ToString;
ink:='NP0001';
laser:='YP0002';
dot:='NP0003';
DM2.Pertanyaan_zq.Next;
DM2.Pertanyaan_zq.Next;
end
else begin
DM2.Pertanyaan_zq.Next;
DM2.Pertanyaan_zq.Next;
jenisPrinter:='Dot Matrix';
s:=s+(tag+3).ToString;
ink:='NP0001';
laser:='NP0002';
dot:='YP0003';
DM2.Pertanyaan_zq.Next;
end;
Add(ink);
Add(laser);
Add(dot);
end;
with Form5.Memo1.Lines do begin
Clear;
if tag = 0 then begin
jenisPrinter:='Ink Jet';
s:=s+(tag+1).ToString;
ink:='YP0001 - Printer Ink Jet';
laser:='NP0002 - Bukan Printer Laser Jet';
dot:='NP0003 - Bukan Printer Dot Matrix';
DM2.Pertanyaan_zq.Next;
DM2.Pertanyaan_zq.Next;
DM2.Pertanyaan_zq.Next;
end
else if tag = 1 then begin
DM2.Pertanyaan_zq.Next;
jenisPrinter:='Laser Jet';
s:=s+(tag+2).ToString;
ink:='NP0001 - Buan Printer Ink Jet';
laser:='YP0002 - Printer Laser Jet';
dot:='NP0003 - Bukan Printer Dot Matrix';
DM2.Pertanyaan_zq.Next;
DM2.Pertanyaan_zq.Next;
end
else begin
DM2.Pertanyaan_zq.Next;
DM2.Pertanyaan_zq.Next;
jenisPrinter:='Dot Matrix';
s:=s+(tag+3).ToString;
ink:='NP0001 - Bukan Printer Ink Jet';
laser:='NP0002 - Bukan Printer Laser Jet';
dot:='YP0003 - Printer Dot Matrix';
DM2.Pertanyaan_zq.Next;
end;
Add(ink);
Add(laser);
Add(dot);
end;
// s := 'SELECT * FROM tabelrule ';
s := 'SELECT a.KodeRule, a.kodepertanyaan1, a.kodekerusakan, '+
'b.NamaKerusakan,b.Penyebab, b.Solusi, b.Gambar '+
'FROM tabelrule a, tabelkerusakan b ';
s2 := '';
for i := 0 to Form6.Memo1.Lines.Count-1 do
begin
s3 := QuotedStr('%' + Trim(Copy(Form6.Memo1.Lines[i],2,5)) + '%');
if Pos('Y',Form6.Memo1.Lines[i]) > 0 then
begin
s2 := s2 + ' AND a.kodepertanyaan1 LIKE ' + s3;
end
else
s2 := s2 + ' AND a.kodepertanyaan1 not LIKE ' + s3;
end;
if Length(s2) > 0 then
begin
Delete(s2,1,4);
s2 := s + ' WHERE ' + s2;
end
else
s2 := s;
s2:= s2 + 'AND a.kodekerusakan = b.KodeKerusakan ORDER BY a.KodeRule';
DM2.pRule_zq.Active := False;
DM2.pRule_zq.SQL.Text := s2;
DM2.pRule_zq.Active := True;
Form5.Label6.Caption:=jenisPrinter;
Hide;
Form5.Show;
end;
end.