Arsip: numpang tanya coding buat hitung insentif berdasar jam kerja
more 12 years ago
angel_tears
procedure TForm3.DateTimePicker2Change(Sender: TObject);
var jamdtg, jamplg : string;
incdtg, incplg : Real;
begin
jamdtg:=StrToDate(DateTimePicker2.Time) ;
if jamdtg between '06.00.00 AM' and '08.00.00 AM' then
begin
incdtg:=3000;
end
else
begin
incdtg:=0;
end;
Edit3.Text:=FloatToStr(incdtg);
end;
kira2 apa yang salah/kurang dr coding diatas ya???
ceritanya gini,saia mo buat aplikasi penghitungan insentif berdasarkan jam kerja,jd misal kalo dateng dibawah jam 8 pagi dpt 3000,pulang di atas jam 17.30 dpt 2000 dst...trus perhitungannya itu pas datetimepickernya berubah nilainya,jumlah insentif itu langsung tampil di Tedit...maap kebanyakan nanya...ane masih newbie.....mohon bantuannya kk2 master delphi yg terhormat....
more 12 years ago
mas_kofa
@angel_tears:kode diatas maksud nya apa?? bukankah jamdtg itu string? dan StrToDate() itu TDate.... dan lagian ngapain juga di convert ke string??procedure TForm3.DateTimePicker2Change(Sender: TObject); var jamdtg, jamplg : string; incdtg, incplg : Real; begin jamdtg:=StrToDate(DateTimePicker2.Time) ; end;
more 12 years ago
mas_kofa
jamdtg:=HourOf(DateTimePicker2.Time) ; //jamdtg ganti integer (int);
if jamdtg in then
begin
incdtg:=3000;
end
else
begin
incdtg:=0;
end;
Edit3.Text:=FloatToStr(incdtg);
end;
NB : tambah kan unit DateUtils di uses.....
more 12 years ago
angel_tears
makasi kk
udah jalan...
tp masih ada 1 yg aq bingung,knp pas di datetimepicker nya di plh jam 8.42,dy masih keluar insentif datang
itu kira2 jam nya bs di batasin lebih spesifik ngga ya??
sekali lagi mohon bantuannya kk...
more 12 years ago
mas_kofa
menit nya diikutsertakan juga.......
jamdtg :=HourOf(DateTimePicker2.Time) ; //jamdtg ganti integer (int);
mendtg := MinuteOf(DateTimePicker2.Time);
jamdtg := jamdtg * 100 + mendtg;
if (jamdtg >= 600) and (jamdtg <= 800) then
begin
incdtg:=3000;
end
else
begin
incdtg:=0;
end;
Edit3.Text:=FloatToStr(incdtg);
end;
kalo lebih presisi lagi...ikut sertakan juga detik nya....
more 12 years ago
angel_tears
utk jam plg nya spt ini ya kk???
procedure TForm3.DateTimePicker3Change(Sender: TObject);
var jamplg,menplg : integer;
incplg : real;
begin
jamplg:=HourOf(DateTimePicker3.Time) ;
menplg:=MinuteOf(DateTimePicker3.Time) ;
jamplg:=jamplg * 100+ menplg;
if (jamplg >=500) and (jamplg<=550) then
begin
incplg:=2000;
end
else if (jamplg >=550) and (jamplg<=600) then
begin
incplg:=2500;
end
else if (jamplg >=600) and (jamplg<=700) then
begin
incplg:=3500;
end
else if (jamplg >=700) and (jamplg<=800) then
begin
incplg:=5000;
end
else
begin
incplg:=0;
end;
Edit4.Text:=FloatToStr(incplg);
end;
tp kok ngga keluar nilainya... :(more ...
- Pages:
- 1
reply |
Report Obsolete
Last Articles
Last Topic
- PascalTalk #6: (Podcast) Kuliah IT di luar negeri, susah gak sih?
by LuriDarmawan in Tutorial & Community Project more 3 years ago - PascalTalk #5: UX: Research, Design and Engineer
by LuriDarmawan in Tutorial & Community Project more 4 years ago - PascalTalk #4: Obrolan Ringan Seputar IT
by LuriDarmawan in Tutorial & Community Project more 4 years ago - PascalTalk #2: Membuat Sendiri SMART HOME
by LuriDarmawan in Tutorial & Community Project more 4 years ago - PascalTalk #3: RADically Fast and Easy Mobile Apps Development with Delphi
by LuriDarmawan in Tutorial & Community Project more 4 years ago - PascalTalk #1: Pemanfaatan Artificial Intelligence di Masa Covid-19
by LuriDarmawan in Tutorial & Community Project more 4 years ago - Tempat Latihan Posting
by LuriDarmawan in OOT more 4 years ago - Archive
- Looping lagi...
by idhiel in Hal umum tentang Pascal Indonesia more 12 years ago - [ask] koneksi ke ODBC user Dsn saat runtime dengan ado
by halimanh in FireBird more 12 years ago - Validasi menggunakan data tanggal
by mas_kofa in Hal umum tentang Pascal Indonesia more 12 years ago
Random Topic
- syntax error in from clause
by fongers in Hal umum tentang Pascal Indonesia more 14 years ago - gmana supaya panel selalu tampil di tengah aplikasi
by fongers in Tip n Trik Pemrograman more 15 years ago - Usul! Benahi Thread, Struktur Sub Forum & Tambah Moderat
by ZeAL in Kritik & Saran more 17 years ago - Backup restore MSSQL di Delphi
by fafenail in Hal umum tentang Pascal Indonesia more 18 years ago - OOT
by diah_intan in Tip n Trik Pemrograman more 16 years ago - Ada yg punya componen devExpress yg doble klik ga??
by unggulresearch in Form Enhancement & Graphical Controls more 13 years ago - (ask) mengatur posisi teks di delphi
by gembel_retro in Hal umum tentang Pascal Indonesia more 15 years ago - Deteksi error zeos
by om20020 in MySQL more 16 years ago - program absensi
by shila in Tip n Trik Pemrograman more 17 years ago - menampilkan detail pada quick report
by yusdi in Reporting more 16 years ago