Documente Academic
Documente Profesional
Documente Cultură
IMPLEMENTASI SISTEM
4.1.
37
Universitas Kristen Petra
38
1. Form Login.
4.1.1.1. Procedure jika tombol Submit ditekan, yang berfungsi untuk mencocokkan
data user dengan data yang ada di database.
39
Segmen Program 4.2. Procedure Reset Login
procedure TFMlogin.cResetClick(Sender: TObject);
begin
cuser.Text:='';
cpass.Text:='';
ctype.Text:='';
cuuser.Text:='';
cupass.Text:='';
cutype.Text:='';
cby.Caption:='';
end;
4.1.2.2.Procedure jika tombol Save ditekan, yang berfungsi untuk menyimpan data
user baru dan password baru.
Segmen Program 4.3. Procedure Save Login
Procedure TFMlogin.cSaveClick(Sender: TObject);
Begin
CSave.SetFocus;
with data do begin
view.SQL.Text:='select * from user_login where
user='''+cuser.Text+'''';
view.Open;
if (view.IsEmpty=true) then begin
if (cuser.Text<>'') and (cpass.EditValue<>null) and
(ctype.Text<>'') then begin
Tuser.Append;
Tuser.FieldValues['user']:=cuser.Text;
Tuser.FieldValues['type']:=ctype.Text;
Tuser.FieldValues['pass']:=Main.Encrypt(cpass.EditValue,'u
ser');
Tuser.FieldValues['user_by']:=Main.user;
Tuser.FieldValues['Updated']:=Main.cstatus.Panels[1].Text;
Tuser.Append;
Tuser.UpdateRecord;
Tuser.Cancel;
Tuser.Close;
40
Tuser.Open;
cuuser.Properties.Items.Clear;
Query1.SQL.Text:='select * from user_login';
Query1.Open;
while not Query1.Eof do begin
cuuser.Properties.Items.Add(Query1.FieldValues['user']);
Query1.Next;
end;
ShowMessage('Saved!!');
cReset.Click;
cuser.SetFocus;
end;
end else
ShowMessage('User sudah Ada!!');
end;
end;
set
and
Query1.Execute;
taccess.Close;
taccess.Open;
end;
end;
4.1.3.2. Procedure jika tombol Disable ditekan, yang berfungsi membatasi user
untuk membuka form atau menu yang tersedia.
41
Segmen Program 4.5. Procedure Access-Disable
procedure TFMlogin_access.cdisableClick(Sender: TObject);
begin
with data do begin
Query1.SQL.Text:='Update
user_access
value='''+'N'+'''
where
type='''+ctype.Text+'''
key_level='''+ckey.Text+'''';
set
and
Query1.Execute;
taccess.Close;
taccess.Open;
end;
end;
i:=0
to
cname_search.Properties.Items.Count-1
do
if
(cname_search.Properties.Items.Strings[i]=ckode.Text) then
cek:=1;
end;
if (cek=0) and (ckode.Text<>'') and (cname.Text<>'') and
(cidtype.Text<>'') and (cid.Text<>'') then begin
With data do begin
Query1.SQL.Text:='insert into supplier values
('''+ckode.Text+''','''+cname.Text+''','''+caddress.Text+''
'
,'''+ccity.Text+''',';
Query1.SQL.Add(''''+cprovince.Text+''','''
+ccountry.Text+''','''+cid.Text+''','''+cidtype.Text+''',
42
'''+cphone.Text+''','''+cfax.Text+''')');
Query1.Execute;
tsupplier.Close;
tsupplier.Open;
tsupplier.First;
cname_search.Properties.Items.Clear;
while not tsupplier.Eof do begin
cname_search.Properties.Items.Add(tsupplier.FieldValues['ko
de_supplier']);
tsupplier.Next;
end;
ckode.Text:='';
cname.Text:='';
caddress.Text:='';
ccity.Text:='';
cprovince.Text:='';
ccountry.Text:='';
cphone.Text:='';
cfax.Text:='';
cidtype.Text:='';
cid.Text:='';
ShowMessage('Save Success !!');
end;
end else begin
ShowMessage('Save Failed !!');
end;
end;
43
Query1.SQL.Text:='Update
supplier
set
supplier_name='''+cname.Text+''',supplier_address='''+caddr
ess.Text+''',
supplier_city='''+ccity.Text+''',supplier_province='''+cpro
vince.Text+'''';
Query1.SQL.Add(',supplier_country='''+ccountry.Text+''',
supplier_phone='''+cphone.Text+''',supplier_fax='''+cfax.Te
xt+'',
supplier_idtype='''+cidtype.Text+''',supplier_id='''+cid.Te
xt+''');
Query1.SQL.Add('where
kode_supplier='''+cname_search.Text+'''');
Query1.Execute;
tsupplier.Close;
tsupplier.Open;
ShowMessage('Update Success !!');
end;
end else
ShowMessage('Update Failed !!');
end;
5. Form MasterWorker.
4.1.5.1.Procedure jika tombol Save ditekan, menyimpan data-data worker ke dalam
tabel worker.
i:=0
to
cname_search.Properties.Items.Count-1
do
if
(cname_search.Properties.Items.Strings[i]=ckode.Text)
then
cek:=1;
end;
44
if (cek=0) and (ckode.Text<>'') and (cname.Text<>'')
and (cidtype.Text<>'')
and (cid.Text<>'') then begin
With data do begin
Query1.SQL.Text:='insert
values('''+ckode.Text+''',
into
worker
'''+cname.Text+''','''+caddress.Text+''',
'''+ccity.Text+'''';
Query1.SQL.Add(','''+cprovince.Text+''','''+ccountry.Text+'
'',
'''+cid.Text+''','''+cidtype.Text+''','''+cphone.Text+''')'
);
Query1.Execute;
tworker.Close;
tworker.Open;
tworker.First;
cname_search.Properties.Items.Clear;
while not tworker.Eof do begin
cname_search.Properties.Items.Add(tworker.FieldValues['kode
_worker']);
tworker.Next;
end;
ckode.Text:='';
cname.Text:='';
caddress.Text:='';
ccity.Text:='';
cprovince.Text:='';
ccountry.Text:='';
cphone.Text:='';
cidtype.Text:='';
cid.Text:='';
ShowMessage('Save Success !!');
end;
end else begin
ShowMessage('Save Failed !!');
end;
end;
45
4.1.5.2.Procedure jika tombol Update ditekan, meng-update data-data worker ke
dalam tabel worker.
worker
set
worker_address='''+caddress.Text+''',
worker_city='''+ccity.Text+''',
worker_province='''+cprovince.Text+'''';
Query1.SQL.Add(',worker_country='''+ccountry.Text+''',
worker_phone='''+cphone.Text+''',
worker_idtype='''+cidtype.Text+''',worker_id='''+cid.Text+'
''');
Query1.SQL.Add('where
kode_worker='''+cname_search.Text+'''');
Query1.Execute;
tworker.Close;
tworker.Open;
ShowMessage('Update Success !!');
end;
end else
ShowMessage('Update Failed !!');
end;
4.1.5.3. Procedure jika tombol Reset ditekan, yang berfungsi untuk membersihkan
semua field yang ada dalam form worker.
46
ckode.Text:='';
cname.Text:='';
caddress.Text:='';
ccity.Text:='';
cprovince.Text:='';
ccountry.Text:='';
cphone.Text:='';
cidtype.Text:='';
cid.Text:='';
end;
where
Query1.Execute;
tworker.Close;
tworker.Open;
tworker.First;
cname_search.Properties.Items.Clear;
while not tworker.Eof do begin
cname_search.Properties.Items.Add(tworker.FieldValues['kode
_worker']);
tworker.Next;
end;
ckode.Text:='';
cname.Text:='';
caddress.Text:='';
ccity.Text:='';
47
cprovince.Text:='';
ccountry.Text:='';
cphone.Text:='';
cidtype.Text:='';
cid.Text:='';
ShowMessage('Delete Success !!');
end;
end else
ShowMessage('Delete Failed !!');
end;
i:=0
to
cname_search.Properties.Items.Count-1
do
if
(cname_search.Properties.Items.Strings[i]=ckode.Text) then
cek:=1;
end;
if (cek=0) and (ckode.Text<>'') and (cname.Text<>'')
and (cidtype.Text<>'')
and (cid.Text<>'')
then begin
With data do begin
Query1.SQL.Text:='insert into customer values
('''+ckode.Text+''','''+cname.Text+''',
'''+caddress.Text+''','''+ccity.Text+'''';
Query1.SQL.Add(','''+cprovince.Text+''','''+ccountry.Text+'
48
'',
'''+cid.Text+''','''+cidtype.Text+''','''+cphone.Text+''',
'''+cfax.Text+''')');
Query1.Execute;
tcustomer.Close;
tcustomer.Open;
tcustomer.First;
cname_search.Properties.Items.Clear;
while not tcustomer.Eof do begin
cname_search.Properties.Items.Add(tcustomer.FieldValues['ko
de_cust']);
tcustomer.Next;
end;
ckode.Text:='';
cname.Text:='';
caddress.Text:='';
ccity.Text:='';
cprovince.Text:='';
ccountry.Text:='';
cphone.Text:='';
cfax.Text:='';
cidtype.Text:='';
cid.Text:='';
ShowMessage('Save Success !!');
end;
end else begin
ShowMessage('Save Failed !!');
end;
end;
49
if
(cname_search.Text<>'')
(cname.Text<>'')
and
(ckode.Text<>'')
and
customer
set
cust_address='''+caddress.Text+''',
cust_city='''+ccity.Text+''',cust_province='''+cprovince.Te
xt+'''';
Query1.SQL.Add(',cust_country='''+ccountry.Text+''',
cust_phone='''+cphone.Text+''',
cust_fax='''+cfax.Text+''',cust_idtype='''+cidtype.Text+'''
,
cust_id='''+cid.Text+'''');
Query1.SQL.Add('where
kode_cust='''+cname_search.Text+'''');
Query1.Execute;
tcustomer.Close;
tcustomer.Open;
ShowMessage('Update Success !!');
end;
end else
ShowMessage('Update Failed !!');
end;
4.1.6.3. Procedure jika tombol Reset ditekan, yang berfungsi untuk membersihkan
semua field yang ada dalam form costumer.
50
cfax.Text:='';
cidtype.Text:='';
cid.Text:='';
end;
where
Query1.Execute;
tcustomer.Close;
tcustomer.Open;
tcustomer.First;
cname_search.Properties.Items.Clear;
while not tcustomer.Eof do begin
cname_search.Properties.Items.Add(tcustomer.FieldValu
es['kode_cust']);
tcustomer.Next;
end;
ckode.Text:='';
cname.Text:='';
caddress.Text:='';
ccity.Text:='';
cprovince.Text:='';
ccountry.Text:='';
cphone.Text:='';
cfax.Text:='';
cidtype.Text:='';
cid.Text:='';
ShowMessage('Delete Success !!');
51
end;
end else
ShowMessage('Delete Failed !!');
end;
end.
i:=0
to
cname_search.Properties.Items.Count-1
do
if
(cname_search.Properties.Items.Strings[i]=ckode.Text) then
cek:=1;
end;
if (cek=0) and (ckode.Text<>'') and (cname.Text<>'') then
begin
With data do begin
Query1.SQL.Text:='insert
into
primary_job
values('''+ckode.Text+''','''+cname.Text+''','''+cdesc.Text
+''',
'''+cvolume_type.Text+''')';
Query1.Execute;
tprimary_job.Close;
tprimary_job.Open;
tprimary_job.First;
cname_search.Text:='';
cname.Text:='';
ckode.Text:='';
cdesc.Text:='';
52
cvolume_type.Text:='';
cname_search.Properties.Items.Clear;
while not tprimary_job.Eof do begin
cname_search.Properties.Items.Add(tprimary_job.FieldValues[
'kode_primary_job']);
tprimary_job.Next;
end;
ShowMessage('Save Success !!');
end;
end else begin
ShowMessage('Save Failed !!');
end;
end;
and
(ckode.Text<>'')
and
53
4.1.7.3. Procedure jika tombol Reset ditekan, yang berfungsi untuk membersihkan
semua field yang ada dalam form primary job.
54
cname.Text:='';
ckode.Text:='';
cdesc.Text:='';
cvolume_type.Text:='';
ShowMessage('Delete Success !!');
end;
end else
ShowMessage('Delete Failed !!');
end;
i:=0
to
cname_search.Properties.Items.Count-1
do
if
(cname_search.Properties.Items.Strings[i]=ckode.Text) then
cek:=1;
end;
if (cek=0) and (ckode.Text<>'') and (cname.Text<>'') then
begin
With data do begin
Query1.SQL.Text:='insert
into
sub_job
values('''+ckode.Text+''','''+cname.Text+''','''+cdesc.Text
+''',
'''+cvolume_type.Text+''')';
Query1.Execute;
tsub_job.Close;
tsub_job.Open;
tsub_job.First;
55
cname_search.Text:='';
cname.Text:='';
ckode.Text:='';
cdesc.Text:='';
cvolume_type.Text:='';
cname_search.Properties.Items.Clear;
while not tsub_job.Eof do begin
cname_search.Properties.Items.Add(tsub_job.FieldValues['kod
e_sub_job']);
tsub_job.Next;
end;
ShowMessage('Save Success !!');
end;
end else begin
ShowMessage('Save Failed !!');
end;
end;
and
(ckode.Text<>'')
and
56
end else
ShowMessage('Update Failed !!');
end;
4.1.8.3. Procedure jika tombol Reset ditekan, yang berfungsi untuk membersihkan
semua field yang ada dalam form Sub job.
sub_job
where
Query1.Execute;
tsub_job.Close;
tsub_job.Open;
tsub_job.First;
cname_search.Properties.Items.Clear;
while not tsub_job.Eof do begin
cname_search.Properties.Items.Add(tsub_job.FieldValues['kod
e_sub_job']);
57
tsub_job.Next;
end;
cname_search.Text:='';
cname.Text:='';
ckode.Text:='';
cdesc.Text:='';
cvolume_type.Text:='';
ShowMessage('Delete Success !!');
end;
end else
ShowMessage('Delete Failed !!');
i:=0
to
cname_search.Properties.Items.Count-1
do
if
(cname_search.Properties.Items.Strings[i]=ckode.Text) then
cek:=1;
end;
if (cek=0) and (ckode.Text<>'') and (cname.Text<>'') then
begin
With data do begin
Query1.SQL.Text:='insert
into
material
values('''+ckode.Text+''','''+cname.Text+''','+floattostr(c
length.Value)+',
'+floattostr(cwidth.Value)+','+floattostr(cheight.Value)+',
'''+cvolume_type.Text+''')';
Query1.Execute;
58
tmaterial.Close;
tmaterial.Open;
tmaterial.First;
cname_search.Text:='';
ckode.Text:='';
cname.Text:='';
cvolume_type.Text:='';
clength.Value:=0;
cwidth.Value:=0;
cheight.Value:=0;
cname_search.Properties.Items.Clear;
while not tmaterial.Eof do begin
cname_search.Properties.Items.Add(tmaterial.FieldValues['ko
de_material']);
tmaterial.Next;
end;
ShowMessage('Save Success !!');
end;
end else begin
ShowMessage('Save Failed !!');
end;
end;
and
(ckode.Text<>'')
and
59
height='+floattostr(cheight.Value)+'';
Query1.SQL.Add('where
kode_material='''+cname_search.Text+'''');
Query1.Execute;
tmaterial.Close;
tmaterial.Open;
ShowMessage('Update Success !!');
end;
end else
ShowMessage('Update Failed !!');
end;
4.1.9.3. Procedure jika tombol Reset ditekan, yang berfungsi untuk membersihkan
semua field yang ada dalam form material.
from
material
where
60
kode_material='''+cname_search.Text+'''';
Query1.Execute;
tmaterial.Close;
tmaterial.Open;
tmaterial.First;
cname_search.Properties.Items.Clear;
while not tmaterial.Eof do begin
cname_search.Properties.Items.Add(tmaterial.FieldValues['ko
de_material']);
tmaterial.Next;
end;
cname_search.Text:='';
ckode.Text:='';
cname.Text:='';
cvolume_type.Text:='';
clength.Value:=0;
cwidth.Value:=0;
cheight.Value:=0;
ShowMessage('Delete Success !!');
end;
end else
ShowMessage('Delete Failed !!');
end;
61
tmaterial_supplier.First;
while not tsupplier.Eof do begin
if
(csupplier.Text=tmaterial_supplier.FieldValues['kode_suppli
er'])
and
(cmaterial.Text=tmaterial_supplier.FieldValues['kode_materi
al']) then
cek:=1;
tmaterial_supplier.Next;
end;
end;
if
(cek=0)
(cmaterial.Text<>'')
and
and
(cunit_type.Text<>'')
(cprice.Value<>0)
(csupplier.Text<>'')
and
(cprice.Text<>'')
and
and
then begin
With data do begin
Query1.SQL.Text:='insert
into
material_supplier
values('''+csupplier.Text+''','''+cmaterial.Text+''',
'''+cunit_type.Text+''','+floattostr(cprice.Value)+')';
Query1.Execute;
tmaterial_supplier.Close;
tmaterial_supplier.Open;
csupplier.Text:='';
cmaterial.Text:='';
cunit_type.Text:='';
cprice.Value:=0;
ShowMessage('Save Success !!');
end;
end else begin
ShowMessage('Save Failed !!');
end;
end;
4.1.10.2.
62
Segmen Program 4.29. Procedure Update-Material_Supplier
Procedure
TObject);
FMmaterial_supplier.cUpdateClick(Sender:
begin
if (csupplier.Text<>'') and
(cunit_type.Text<>'')
and
(cprice.Value<>0) then begin
(cmaterial.Text<>'')
(cprice.Text<>'')
and
and
and
Query1.Execute;
tmaterial_supplier.Close;
tmaterial_supplier.Open;
ShowMessage('Update Success !!');
end;
end else
ShowMessage('Update Failed !!');
end;
4.1.10.3.
TFMmaterial_supplier.cResetClick(Sender:
begin
csupplier.Text:='';
cmaterial.Text:='';
cunit_type.Text:='';
cprice.Value:=0;
end;
63
4.1.10.4.
TFMmaterial_supplier.cDeleteClick(Sender:
begin
if (csupplier.Text<>'')
begin
and
(cmaterial.Text<>'')
then
i:=0
to
cname_search.Properties.Items.Count-1
do
if
(cname_search.Properties.Items.Strings[i]=ckode.Text) then
cek:=1;
64
end;
if (cek=0) and (ckode.Text<>'') and (cname.Text<>'') and
(clocation.Text<>'')
begin
and
(ckode_customer.Text<>'')
then
4.1.11.2.
65
Segmen Program 4.33. Procedure Update-Project_Header
procedure TFPProject_header.cUpdateClick(Sender: TObject);
begin
if
(cname_search.Text<>'')
and
(ckode.Text<>'')
(cname.Text<>'')
and
(clocation.Text<>'')
(ckode_customer.Text<>'') then begin
and
and
4.1.11.3.
66
4.1.11.4.
where
Query1.Execute;
tproject_header.Close;
tproject_header.Open;
tproject_header.First;
cname_search.Properties.Items.Clear;
while not tproject_header.Eof do begin
cname_search.Properties.Items.Add(tproject_header.FieldValu
es['kode_project']);
tproject_header.Next;
end;
cname_search.Text:='';
ckode.Text:='';
cname.Text:='';
clocation.Text:='';
ckode_customer.Text:='';
ccustomer_name.Caption:='';
ShowMessage('Delete Success !!');
end;
end else
ShowMessage('Delete Failed !!');
end;
67
Segmen Program 4.36. Procedure Project_Header
procedure TFPDetail_project.cSaveClick(Sender: TObject);
var cek:byte;
i:integer;
begin
cek:=0;
for
begin
i:=0
to
cname_search.Properties.Items.Count-1
do
if
(cname_search.Properties.Items.Strings[i]=ckode.Text) then
cek:=1;
end;
if (cek=0) and (ckode.Text<>'') and (cname.Text<>'') and
(ckode_project.Text<>'')and
(ckode_sub_job.Text<>'')
(ckode_job.Text<>'')
and
then begin
With data do begin
Query1.SQL.Text:=
'insert
into
project_detail
values('''+ckode.Text+''','''+ckode_project.Text+''','''+c
name.Text+''',
'''+ckode_job.Text+''','''+ckode_sub_job.Text+''','+floatt
ostr(clength.Value)+',
'''+cvolume_type.Text+''','+floattostr(ctime.Value)+','+fl
oattostr(cstart_periode.Value)+',
'+floattostr(cjob_fee.Value)+')';
Query1.Execute;
tdetail_project.Close;
tdetail_project.Open;
tdetail_project.First;
cname_search.Text:='';
ckode_project.Text:='';
ckode_job.Text:='';
cjob_name.Caption:='';
ckode_sub_job.Text:='';
ckode.Text:='';
cname.Text:='';
csub_job_name.Caption:='';
cvolume_type.Text:='';
68
clength.Value:=0;
ctime.Value:=0;
cstart_periode.Value:=0;
cjob_fee.Value:=0;
query1.SQL.Text:='select
project_detail
project_detail_name
where kode_project='''+cproject_search.Text+'''
project_detail_name';
from
group
by
Query1.Open;
Query1.First;
cname_search.Properties.Items.Clear;
while not Query1.Eof do begin
cname_search.Properties.Items.Add(Query1.FieldValues['proj
ect_detail_name']);
Query1.Next;
end;
ShowMessage('Save Success !!');
end;
end else begin
ShowMessage('Save Failed !!');
end;
end;
4.1.12.2.
set
type_volume='''+cvolume_type.Text+''',
volume='+floattostr(clength.Value)+',time='+floattostr(ctim
69
e.Value)+',
start_periode='+floattostr(cstart_periode.Value)+'';
Query1.SQL.Add(',job_fee='+floattostr(cjob_fee.value)+'
where kode_project_detail='''+ckode.Text+'''');
Query1.Execute;
tdetail_project.Close;
tdetail_project.Open;
ShowMessage('Update Success !!');
end;
end else
ShowMessage('Update Failed !!');
end;
4.1.12.3.
70
4.1.12.4.
71
13. Form Proses Material Project.
4.1.13.1.
(cxLabel1.Caption<>'')
and
(cvolume.Text<>'')
and
and
then begin
With data do begin
Query1.SQL.Text:='insert
into
material_project
values('''+cxLabel1.Caption+''','''+cmaterial.Text+''',
'''+cvolume_type.Text+''','+floattostr(cvolume.Value)+',
'+floattostr(cprice.Value)+','+floattostr(cpemkab_high.Valu
e)+',
'+floattostr(cpemkab_medium.Value)+')';
Query1.Execute;
tmaterial_project.Close;
tmaterial_project.Open;
cmaterial.Text:='';
72
cmaterial_name.Caption:='';
cvolume_type.Text:='';
cvolume.Value:=0;
cprice.Value:=0;
cpemkab_high.Value:=0;
cpemkab_medium.Value:=0;
ShowMessage('Save Success !!');
end;
end else begin
ShowMessage('Save Failed !!');
end;
end;
4.1.13.2.
TFPmaterial_project.cUpdateClick(Sender:
begin
if (cxLabel1.Caption<>'') and (cmaterial.Text<>'')
and (cvolume_type.Text<>'') and (cvolume.Text<>'')
and (cvolume.Value<>0) then begin
With data do begin
Query1.SQL.Text:='Update
material_project
kode_material='''+cmaterial.Text+''',
set
volume_type='''+cvolume_type.Text+''',volume=
'+floattostr(cvolume.Value)+',price='+floattostr(cprice.Val
ue)+',
price_pemkab_high='+floattostr(cpemkab_high.Value)+',';
Query1.SQL.Add('price_pemkab_medium='+floattostr(cpemkab_me
dium.Value)+'
where
and
kode_project_detail='''+cxLabel1.Caption+'''
kode_material='''+cmaterial.Text+'''');
Query1.Execute;
tmaterial_project.Close;
tmaterial_project.Open;
73
ShowMessage('Update Success !!');
end;
end else
ShowMessage('Update Failed !!');
end;
4.1.13.3.
4.1.13.4.
TFPmaterial_project.cDeleteClick(Sender:
begin
if (cxLabel1.Caption<>'') and (cmaterial.Text<>'')
begin
then
74
tmaterial_project.Close;
tmaterial_project.Open;
ShowMessage('Delete Success !!');
end;
end else
ShowMessage('Delete Failed !!');
end;
and
and
75
lue)+','+floattostr(cpemkab_medium.value)+')';
Query1.Execute;
tworker_salary.Close;
tworker_salary.Open;
cposition.Text:='';
csalary.Value:=0;
csalary_type.Text:='';
cpemkab_high.Value:=0;
cpemkab_medium.Value:=0;
cquantity.Value:=0;
ShowMessage('Save Success !!');
end;
end else begin
ShowMessage('Save Failed !!');
end;
end;
4.1.14.2.
and
(cposition.Text<>'')
and
and
(csalary.Value<>0) then begin
With data do begin
Query1.SQL.Text:='Update
worker_salary set salary='+floattostr(csalary.Value)+',
volume_type='''+csalary_type.Text+''',
koefesien='+floattostr(cquantity.Value)+',';
Query1.SQL.Add
('price_pemkab_high='+floattostr(cpemkab_high.Value)+',
price_pemkab_medium='+floattostr(cpemkab_medium.Value)+'
where
76
kode_project_detail='''+cxLabel1.Caption+'''
and position='''+cposition.Text+'''');
Query1.Execute;
tworker_salary.Close;
tworker_salary.Open;
ShowMessage('Update Success !!');
end;
end else
ShowMessage('Update Failed !!');
end;
4.1.14.3.
4.1.14.4.
then
from
worker_salary
where
and
77
kode_project_detail='''+cxLabel1.Caption+'''';
Query1.Execute;
tworker_salary.Close;
tworker_salary.Open;
ShowMessage('Delete Success !!');
end;
end else
ShowMessage('Delete Failed !!');
end;
78
ostr(cquantity.Value)+',
'''+crent_type.Text+''')';
Query1.Execute;
trent_equipment.Close;
trent_equipment.Open;
ckode_project.Text:='';
cequipment.Text:='';
cequipment_name.Caption:='';
cperiode.Text:='';
cprice.Value:=0;
cquantity.Value:=0;
crent_type.Text:='';
ShowMessage('Save Success !!');
end;
end else begin
ShowMessage('Save Failed !!');
end;
end;
4.1.15.2.
and
Query1.Execute;
trent_equipment.Close;
79
trent_equipment.Open;
ShowMessage('Update Success !!');
end;
end else
ShowMessage('Update Failed !!');
end;
4.1.15.3.
4.1.15.4.
and
(cequipment.Text<>'')
then
where
and
Query1.Execute;
trent_equipment.Close;
80
trent_equipment.Open;
ShowMessage('Delete Success !!');
end;
end else
ShowMessage('Delete Failed !!');
end;
where
Query1.Open;
while not Query1.Eof do begin
cname.Caption:=Query1.FieldValues['project_name'];
clocation.Caption:=Query1.FieldValues['project_location'];
Query1.Next;
end;
view.SQL.Text:='Select
volume_type,material_name,price,price_pemkab_high,price_pem
kab_medium,((price/price_pemkab_high)*100)
as
analisis_high,((price/price_pemkab_medium)*100)
as
analisis_medium from project_detail ';
view.SQL.Add('inner
join
material_project
on
project_detail.kode_project_detail=material_project.kode_pr
oject_detail');
view.SQL.Add('inner
join
material
on
material_project.kode_material=material.kode_material where
kode_project='''+cproject_kode.Text+'''
group
by
material_project.kode_material');
view.Open;
81
view2.SQL.Text:='Select
volume_type,position,salary,price_pemkab_high,
price_pemkab_medium,((salary/price_pemkab_high)*100)
analisis_high,((salary/price_pemkab_medium)*100)
analisis_medium from project_detail ';
as
as
view2.SQL.Add('inner
join
worker_salary
on
project_detail.kode_project_detail=worker_salary.kode_proje
ct_detail');
view2.SQL.Add('where
kode_project='''+cproject_kode.Text+'''
position');
group
by
view2.Open;
view3.SQL.Text:=
'Select
equipment_name,periode,rent_type,price,quantity
from rent_equipment ';
view3.SQL.Add
('inner
join
equipment
on
rent_equipment.kode_equipment=equipment.kode_equipment');
view3.SQL.Add
('where kode_project='''+cproject_kode.Text+'''');
view3.Open;
end;
end;
4.1.16.2.
TFRMaterial_analisis.cexportClick(Sender:
begin
page_setup;
cetak;
xls.Workbooks[1].Saveas(ExtractFilePath(Application.ExeName
Analisis
)+'DatabaseExcel\'+'Material-Salary
('+cproject_kode.Text+').xls');
end;
82
17. Form Report RAP
4.1.17.1.
TFRRAP.cproject_kodePropertiesChange(Sender:
begin
with data do begin
Query1.SQL.Text:='select * from project_header
kode_project='''+cproject_kode.Text+'''';
where
Query1.Open;
while not Query1.Eof do begin
cname.Caption:=Query1.FieldValues['project_name'];
clocation.Caption:=Query1.FieldValues['project_location'];
Query1.Next;
end;
view.SQL.Text:='Select
project_detail_name,primary_job_name,sum(material_project.v
olume*price*project_detail.volume) as tot_material from
project_detail ';
view.SQL.Add('inner
join
primary_job
on
project_detail.kode_primary_job=primary_job.kode_primary_jo
b');
view.SQL.Add('inner
join
material_project
on
project_detail.kode_project_detail=material_project.kode_pr
oject_detail');
view.SQL.Add('where
kode_project='''+cproject_kode.Text+'''
project_detail.kode_primary_job');
group
by
view.Open;
view2.SQL.Text:='Select
project_detail_name,primary_job_name,sum(koefesien*salary*v
olume) as tot_salary from project_detail ';
view2.SQL.Add('inner
join
primary_job
on
project_detail.kode_primary_job=primary_job.kode_primary_jo
b');
view2.SQL.Add('inner
join
worker_salary
on
project_detail.kode_project_detail=worker_salary.kode_proje
83
ct_detail');
view2.SQL.Add('where
kode_project='''+cproject_kode.Text+'''
project_detail.kode_primary_job');
group
by
view2.Open;
view3.SQL.Text:='Select
project_detail.kode_project_detail,type_volume,sum(project_
detail.volume)
as
isi,project_detail_name,primary_job_name,sub_job_name,sum(m
as
aterial_project.volume*price*project_detail.volume)
tot_material from project_detail ';
view3.SQL.Add('inner
join
primary_job
on
project_detail.kode_primary_job=primary_job.kode_primary_jo
b');
view3.SQL.Add('inner
join
sub_job
project_detail.kode_sub_job=sub_job.kode_sub_job');
on
view3.SQL.Add('inner
join
material_project
on
project_detail.kode_project_detail=material_project.kode_pr
oject_detail');
view3.SQL.Add('where
kode_project='''+cproject_kode.Text+'''
group
project_detail.kode_sub_job,project_detail_name');
by
view3.Open;
view4.SQL.Text:='Select
project_detail.kode_project_detail,sum(koefesien*salary) as
sat_upah,type_volume,(volume) as isi,project_detail_name';
view4.SQL.Add(',primary_job_name,sub_job_name,sum(koefesien
*salary*volume) as tot_salary from project_detail inner
join
primary_job
on
project_detail.kode_primary_job=primary_job.kode_primary_jo
b');
view4.SQL.Add('inner
join
sub_job
project_detail.kode_sub_job=sub_job.kode_sub_job');
on
view4.SQL.Add('inner
join
worker_salary
on
project_detail.kode_project_detail=worker_salary.kode_proje
ct_detail');
view4.SQL.Add('where
kode_project='''+cproject_kode.Text+'''
group
project_detail.kode_sub_job,project_detail_name');
by
view4.Open;
view5.SQL.Text:='Select
material_name,volume_type,sum(project_detail.volume)
as
vol,price,sum(material_project.volume*price*project_detail.
volume) as total from project_detail ';
84
view5.SQL.Add('inner
join
material_project
on
project_detail.kode_project_detail=material_project.kode_pr
oject_detail');
view5.SQL.Add('inner
join
material
on
material_project.kode_material=material.kode_material');
view5.SQL.Add('where
kode_project='''+cproject_kode.Text+'''
material_project.kode_material');
group
by
view5.Open;
end;
end;
4.1.17.2.
TFRProject_time.cprojectPropertiesChange(Sender:
begin
csubproject.Text:='';
With data do begin
Query1.SQL.text:='select project_name,project_location
from
project_header
where
85
kode_project='''+cproject.Text+'''';
Query1.Open;
if (Query1.FieldValues['project_name']<>null) then
cproject_name.Caption:=Query1.FieldValues['project_name']
else
cproject_name.Caption:='';
if (Query1.FieldValues['project_location']<>null) then
clocation.Caption:=Query1.FieldValues['project_location']
else
clocation.Caption:='';
Query1.SQL.text:='select
project_detail_name
from
project_detail
where
kode_project='''+cproject.Text+'''
group by project_detail_name';
Query1.Open;
Query1.First;
csubproject.Properties.Items.Clear;
while not Query1.Eof do begin
csubproject.Properties.Items.Add(Query1.FieldValues['projec
t_detail_name']);
Query1.Next;
end;
Query1.Close;
end;
end;
4.1.18.2.
86
cetak;
sheet.PageSetup.PrintTitleRows:='$A1:$i8';
xls.Workbooks[1].Saveas(ExtractFilePath(Application.ExeName
)+'DatabaseExcel\'+'Schedulling
Time'+cproject_name.Caption+'-'+csubproject.Text+'.xls');
end;
4.1.18.3.