LISTING PROGRAM

Audisi.dpr

program Audisi;

uses
  Forms,
  Open in 'Open.pas' {FOpen},
  Utama in 'Utama.pas' {FUtama},
  UAudisi in 'UAudisi.pas' {FAudisi},
  Modul in 'Modul.pas' {Dm: TDataModule},
  PilAudisi in 'PilAudisi.pas' {FPilAudisi},
  Peserta in 'Peserta.pas' {FPeserta},
  Juri in 'Juri.pas' {FJuri},
  Kategori in 'Kategori.pas' {FKategori},
  PilKategori in 'PilKategori.pas' {FPilKategori},
  Klasifikasi in 'Klasifikasi.pas' {FKlasifikasi},
  PilPeserta in 'PilPeserta.pas' {FPilPeserta},
  Nilai in 'Nilai.pas' {FNilai},
  DafKategori in 'DafKategori.pas' {QrKategori: TQuickRep},
  DafPeserta in 'DafPeserta.pas' {QrPeserta: TQuickRep},
  DafJuri in 'DafJuri.pas' {QrJuri: TQuickRep},
  DafNilaiPerKategoriPerJuri in 'DafNilaiPerKategoriPerJuri.pas' {QrNilaiKategoriJuri: TQuickRep},
  PilJuri in 'PilJuri.pas' {FPilJuri},
  DafNilaiPerKlasifikasiPerJuri in 'DafNilaiPerKlasifikasiPerJuri.pas' {QrNilaiKlasifikasiJuri: TQuickRep},
  DafNilaiKeseluruhan in 'DafNilaiKeseluruhan.pas' {QrNilaiKeseluruhan: TQuickRep},
  DafNilaiTotal in 'DafNilaiTotal.pas' {QrNilaiTotal: TQuickRep},
  JuaraKomunitas in 'JuaraKomunitas.pas' {FJuaraKomunitas},
  SeleksiAudisi in 'SeleksiAudisi.pas' {FSeleksiAudisi},
  PilAudisi2 in 'PilAudisi2.pas' {FPilAudisi2},
  JuaraPeserta in 'JuaraPeserta.pas' {FJuaraPeserta},
  DafNilaiJuaraKomunitas in 'DafNilaiJuaraKomunitas.pas' {QrNilaiJuaraKomunitas: TQuickRep},
  PilJuaraKategori in 'PilJuaraKategori.pas' {FPilJuaraKategori},
  DafNilaiJuaraKategori in 'DafNilaiJuaraKategori.pas' {QrNilaiJuaraKategori: TQuickRep},
  DafJuara in 'DafJuara.pas' {QrJuara: TQuickRep},
  UnitAudisi in 'UnitAudisi.pas' {FormAudisi},
  Login in 'Login.pas' {FLogin};

{$R *.res}

begin
  Application.Initialize;
  Application.CreateForm(TFLogin, FLogin);
  Application.CreateForm(TFOpen, FOpen);
  Application.CreateForm(TFUtama, FUtama);
  Application.CreateForm(TFAudisi, FAudisi);
  Application.CreateForm(TDm, Dm);
  Application.CreateForm(TFPilAudisi, FPilAudisi);
  Application.CreateForm(TFPeserta, FPeserta);
  Application.CreateForm(TFJuri, FJuri);
  Application.CreateForm(TFKategori, FKategori);
  Application.CreateForm(TFPilKategori, FPilKategori);
  Application.CreateForm(TFKlasifikasi, FKlasifikasi);
  Application.CreateForm(TFPilPeserta, FPilPeserta);
  Application.CreateForm(TFNilai, FNilai);
  Application.CreateForm(TQrKategori, QrKategori);
  Application.CreateForm(TQrPeserta, QrPeserta);
  Application.CreateForm(TQrJuri, QrJuri);
  Application.CreateForm(TQrNilaiKategoriJuri, QrNilaiKategoriJuri);
  Application.CreateForm(TFPilJuri, FPilJuri);
  Application.CreateForm(TQrNilaiKlasifikasiJuri, QrNilaiKlasifikasiJuri);
  Application.CreateForm(TQrNilaiKeseluruhan, QrNilaiKeseluruhan);
  Application.CreateForm(TQrNilaiTotal, QrNilaiTotal);
  Application.CreateForm(TFJuaraKomunitas, FJuaraKomunitas);
  Application.CreateForm(TFSeleksiAudisi, FSeleksiAudisi);
  Application.CreateForm(TFPilAudisi2, FPilAudisi2);
  Application.CreateForm(TFJuaraPeserta, FJuaraPeserta);
  Application.CreateForm(TQrNilaiJuaraKomunitas, QrNilaiJuaraKomunitas);
  Application.CreateForm(TFPilJuaraKategori, FPilJuaraKategori);
  Application.CreateForm(TQrNilaiJuaraKategori, QrNilaiJuaraKategori);
  Application.CreateForm(TQrJuara, QrJuara);
  Application.CreateForm(TFormAudisi, FormAudisi);
  Application.Run;
end.

Modul.pas

unit Modul;

interface

uses
  SysUtils, Classes, DB, DBTables, ADODB;

type
  TDm = class(TDataModule)
    DsAudisi: TDataSource;
    DsQAudisi: TDataSource;
    Peserta: TTable;
    DsPeserta: TDataSource;
    DsQPeserta: TDataSource;
    Juri: TTable;
    QJuri: TQuery;
    DsJuri: TDataSource;
    DsQJuri: TDataSource;
    JuriKd_Juri: TStringField;
    JuriNm_Juri: TStringField;
    JuriAlamat: TStringField;
    JuriTelp: TStringField;
    JuriBiografi: TMemoField;
    JuriKd_Audisi: TStringField;
    QJuriKd_Juri: TStringField;
    QJuriNm_Juri: TStringField;
    QJuriAlamat: TStringField;
    QJuriTelp: TStringField;
    QJuriBiografi: TMemoField;
    QJuriKd_Audisi: TStringField;
    Kategori: TTable;
    QKategori: TQuery;
    DsKategori: TDataSource;
    DsQKategori: TDataSource;
    KategoriKd_Kategori: TStringField;
    KategoriNm_Kategori: TStringField;
    KategoriKd_Audisi: TStringField;
    KategoriBobot: TFloatField;
    QKategoriKd_Kategori: TStringField;
    QKategoriNm_Kategori: TStringField;
    QKategoriKd_Audisi: TStringField;
    QKategoriBobot: TFloatField;
    Klasifikasi: TTable;
    QKlasifikasi: TQuery;
    DsKlasifikasi: TDataSource;
    DsQKlasifikasi: TDataSource;
    KlasifikasiKd_Klasifikasi: TStringField;
    KlasifikasiNm_Klasifikasi: TStringField;
    KlasifikasiKd_Kategori: TStringField;
    QKlasifikasiKd_Klasifikasi: TStringField;
    QKlasifikasiNm_Klasifikasi: TStringField;
    QKlasifikasiKd_Kategori: TStringField;
    PesertaKd_Peserta: TStringField;
    PesertaNm_Komunitas: TStringField;
    PesertaInstitusi: TStringField;
    PesertaAlamat: TStringField;
    PesertaTelp: TStringField;
    PesertaNo_Peserta: TStringField;
    PesertaMateri: TMemoField;
    PesertaKd_Audisi: TStringField;
    Nilai: TTable;
    DsNilai: TDataSource;
    DsDtNilai: TDataSource;
    NilaiKd_Nilai: TStringField;
    NilaiKd_Audisi: TStringField;
    NilaiKd_Peserta: TStringField;
    NilaiKd_Juri: TStringField;
    NilaiTotal: TFloatField;
    QNilai1: TQuery;
    DsQNilai1: TDataSource;
    QNilai: TQuery;
    DsQNilai: TDataSource;
    QNilaiKd_Nilai: TStringField;
    QNilaiKd_Audisi: TStringField;
    QNilaiKd_Peserta: TStringField;
    QNilaiKd_Juri: TStringField;
    QNilaiTotal: TFloatField;
    DsQKlasifiaksi2: TDataSource;
    DtNilai: TTable;
    DtNilaiKd_Nilai: TStringField;
    DtNilaiKd_Klasifikasi: TStringField;
    DtNilaiNilai: TFloatField;
    QKlasifikasi2: TQuery;
    QKlasifikasi2Kd_Klasifikasi: TStringField;
    QKlasifikasi2Nm_Klasifikasi: TStringField;
    QKlasifikasi2Kd_Kategori: TStringField;
    QKlasifikasi2Nm_Kategori: TStringField;
    QKlasifikasi2Kd_Audisi: TStringField;
    QKlasifikasi2Bobot: TFloatField;
    QNilai1kd_nilai: TStringField;
    QNilai1kd_juri: TStringField;
    QNilai1kd_klasifikasi: TStringField;
    QNilai1nm_klasifikasi: TStringField;
    QNilai1kd_kategori: TStringField;
    QNilai1bobot: TFloatField;
    QNilai1nilai: TFloatField;
    QNilai1kd_audisi: TStringField;
    QNilai1kd_peserta: TStringField;
    QNilai1NilaiBobot: TFloatField;
    QNilai1nm_kategori: TStringField;
    QNilai2: TQuery;
    DsQNilai2: TDataSource;
    QNilai3: TQuery;
    DsQNilai3: TDataSource;
    Database1: TDatabase;
    QPeserta: TQuery;
    QPesertaKd_Peserta: TStringField;
    QPesertaNm_Komunitas: TStringField;
    QPesertaInstitusi: TStringField;
    QPesertaAlamat: TStringField;
    QPesertaTelp: TStringField;
    QPesertaNo_Peserta: TStringField;
    QPesertaMateri: TMemoField;
    QPesertaKd_Audisi: TStringField;
    Audisi: TTable;
    QAudisi: TQuery;
    QAudisiKd_Audisi: TStringField;
    QAudisiNm_Audisi: TStringField;
    QAudisiTanggal: TDateField;
    QAudisiTempat: TStringField;
    QAudisiKategori: TStringField;
    AudisiKd_Audisi: TStringField;
    AudisiNm_Audisi: TStringField;
    AudisiTanggal: TDateField;
    AudisiTempat: TStringField;
    AudisiKategori: TStringField;
    QNilai4: TQuery;
    QNilai3nm_juri: TStringField;
    QNilai3total: TFloatField;
    QNilai3kd_audisi: TStringField;
    DsQNilai4: TDataSource;
    QNilai4no_peserta: TStringField;
    QNilai4nm_komunitas: TStringField;
    QNilai4SUMOFtotal: TFloatField;
    QNilai4kd_audisi: TStringField;
    DsTempSeleksi: TDataSource;
    QTempSeleksi: TQuery;
    DsQTempSeleksi: TDataSource;
    QTempSeleksi2: TQuery;
    DsQTempSeleksi2: TDataSource;
    QTempSeleksi2nilai: TFloatField;
    TempSeri: TTable;
    DsTempSeri: TDataSource;
    TempSeriNomor: TStringField;
    TempSeriKomunitas: TStringField;
    TempSeriNilai: TFloatField;
    QTempSeri: TQuery;
    DsQTempSeri: TDataSource;
    QTempSerino_peserta: TStringField;
    QTempSerinm_komunitas: TStringField;
    QTempSeriSUMOFnilai: TFloatField;
    QTempSeri2: TQuery;
    DsTempSeri2: TDataSource;
    QTempSeri2Nomor: TStringField;
    QTempSeri2Komunitas: TStringField;
    QTempSeri2Nilai: TFloatField;
    TempSeleksi: TTable;
    TempSeleksiNo: TFloatField;
    TempSeleksiNomor: TStringField;
    TempSeleksiKomunitas: TStringField;
    TempSeleksiNilai: TFloatField;
    Juara: TTable;
    DsJuara: TDataSource;
    JuaraKd_Juara: TStringField;
    JuaraNm_Juara: TStringField;
    JuaraKd_Peserta: TStringField;
    JuaraKd_Audisi: TStringField;
    JuaraKtgr_Juara: TStringField;
    JuaraKd_Kategori: TStringField;
    QJuara: TQuery;
    DsQJuara: TDataSource;
    QJuaraKd_Juara: TStringField;
    QJuaraNm_Juara: TStringField;
    QJuaraKd_Peserta: TStringField;
    QJuaraKd_Audisi: TStringField;
    QJuaraKtgr_Juara: TStringField;
    QJuaraKd_Kategori: TStringField;
    QTempSeleksi3: TQuery;
    DsQTempSeleksi3: TDataSource;
    QTempSeleksi3no_peserta: TStringField;
    QTempSeleksi3nm_komunitas: TStringField;
    QTempSeleksi3institusi: TStringField;
    QTempSeleksi3alamat: TStringField;
    QTempSeleksi3telp: TStringField;
    QTempSeleksi3kd_audisi: TStringField;
    TempSeleksiNilai1: TFloatField;
    TempSeleksiNilai2: TFloatField;
    QNilai5: TQuery;
    DsQNilai5: TDataSource;
    QJuara1: TQuery;
    DsJuara1: TDataSource;
    QJuara1Kd_Juara: TStringField;
    QJuara1Nm_Juara: TStringField;
    QJuara1Kd_Peserta: TStringField;
    QJuara1Kd_Audisi: TStringField;
    QJuara1Ktgr_Juara: TStringField;
    QJuara1Kd_Kategori: TStringField;
    QJuara1Nm_Komunitas: TStringField;
    QJuara1Institusi: TStringField;
    QJuara1Alamat: TStringField;
    QJuara1Telp: TStringField;
    QJuara1No_Peserta: TStringField;
    QJuara1Materi: TMemoField;
    QNilai6: TQuery;
    DsQNilai6: TDataSource;
    QNilai6AVERAGEOFNilai: TFloatField;
    QNilai2kd_peserta: TStringField;
    QNilai2kd_juri: TStringField;
    QNilai2kd_kategori: TStringField;
    QNilai2nm_kategori: TStringField;
    QNilai2AVERAGEOFnilai: TFloatField;
    QNilai2kd_audisi: TStringField;
    QNilai2NilaiBobot: TFloatField;
    QNilai2bobot: TFloatField;
    QTempSeleksiNo: TFloatField;
    QTempSeleksiNomor: TStringField;
    QTempSeleksiKomunitas: TStringField;
    QTempSeleksiNilai1: TFloatField;
    QTempSeleksiNilai2: TFloatField;
    QTempSeleksiNilai: TFloatField;
    QTempSeleksiSelisih: TFloatField;
    TempSeleksiKriteria: TStringField;
    QTempSeleksiKriteria: TStringField;
    QTempSeleksiNmKriteria: TStringField;
    QPeserta2: TQuery;
    DsQPeserta2: TDataSource;
    QPeserta2Kd_Peserta: TStringField;
    QPeserta2Nm_Komunitas: TStringField;
    QPeserta2Institusi: TStringField;
    QPeserta2Alamat: TStringField;
    QPeserta2Telp: TStringField;
    QPeserta2No_Peserta: TStringField;
    QPeserta2Materi: TMemoField;
    QPeserta2Kd_Audisi: TStringField;
    QNilai5no_peserta: TStringField;
    QNilai5nm_komunitas: TStringField;
    QNilai5SUMOFbobot100n: TFloatField;
    QNilai5kd_audisi: TStringField;
    procedure QNilai1CalcFields(DataSet: TDataSet);
    procedure QTempSeleksiCalcFields(DataSet: TDataSet);
    procedure QNilai2CalcFields(DataSet: TDataSet);
  private
    { Private declarations }
  public
    { Public declarations }
     KdJuriX : String;
  end;

var
  Dm: TDm;

implementation

uses Utama;

{$R *.dfm}

procedure TDm.QNilai1CalcFields(DataSet: TDataSet);
Var I, J : Byte;
    TotNilai : Real;
begin
 //Mencari Nilai Rata-Rata
 With Dm.QNilai6 do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select avg(a.Nilai) ');
  Sql.add('From DtNilai a, Klasifikasi b, Nilai c ');
  Sql.add('Where a.Kd_Klasifikasi=b.Kd_Klasifikasi and a.Kd_Nilai=c.Kd_Nilai ');
  Sql.add('and Kd_Juri = "'+KdJuriX+'" and Kd_Nilai = "'+Dm.QNilai1Kd_Nilai.Value+'" and Kd_kategori = "'+Dm.QNilai1kd_kategori.Value+'" ');
  Sql.add('group by b.Kd_Kategori ');
  Prepare;
  Open;
 End;
 TotNilai := Dm.QNilai6AVERAGEOFNilai.Value;

 If Copy(Dm.QNilai1kd_klasifikasi.Value, 10,1) = '1' Then
  Dm.QNilai1NilaiBobot.Value := TotNilai * (Dm.QNilai1bobot.Value/100)
 Else
  Dm.QNilai1NilaiBobot.Value := 0;
end;

procedure TDm.QTempSeleksiCalcFields(DataSet: TDataSet);
begin
 Dm.QTempSeleksiSelisih.Value := Dm.QTempSeleksiNilai2.Value - Dm.QTempSeleksiNilai1.Value;
 If Dm.QTempSeleksiKriteria.Value = 'B' Then Dm.QTempSeleksiNmKriteria.Value := 'Baik'
  Else If Dm.QTempSeleksiKriteria.Value = 'C' Then Dm.QTempSeleksiNmKriteria.Value := 'Cukup'
   Else If Dm.QTempSeleksiKriteria.Value = 'K' Then Dm.QTempSeleksiNmKriteria.Value := 'Kurang';
end;

procedure TDm.QNilai2CalcFields(DataSet: TDataSet);
begin
 QNilai2NilaiBobot.Value := QNilai2AVERAGEOFnilai.Value * (QNilai2bobot.Value/100);
end;

end.

Open.pas

unit Open;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, Buttons, jpeg, StdCtrls;

type
  TFOpen = class(TForm)
    Bevel1: TBevel;
    Baru: TSpeedButton;
    Pilih: TSpeedButton;
    Keluar: TSpeedButton;
    Image1: TImage;
    Bevel2: TBevel;
    procedure KeluarClick(Sender: TObject);
    procedure BaruClick(Sender: TObject);
    procedure PilihClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FOpen: TFOpen;

implementation

uses UAudisi, PilAudisi, Modul;

{$R *.dfm}

procedure TFOpen.KeluarClick(Sender: TObject);
begin
 Application.Terminate;
end;

procedure TFOpen.BaruClick(Sender: TObject);
begin
 FAudisi.Status:= '0';
 FAudisi.ShowModal;
end;

procedure TFOpen.PilihClick(Sender: TObject);
begin
 FPilAudisi.ShowModal;
end;

end.

Login.pas

unit Login;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Mask, Buttons, ExtCtrls;

type
  TFLogin = class(TForm)
    Bevel5: TBevel;
    Bevel1: TBevel;
    Bevel2: TBevel;
    Label1: TLabel;
    Bevel4: TBevel;
    Login: TBitBtn;
    Keluar: TBitBtn;
    MaskEdit1: TMaskEdit;
    procedure FormActivate(Sender: TObject);
    procedure MaskEdit1KeyPress(Sender: TObject; var Key: Char);
    procedure LoginClick(Sender: TObject);
    procedure KeluarClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FLogin: TFLogin;

implementation

uses Open;

{$R *.dfm}

procedure TFLogin.FormActivate(Sender: TObject);
begin
 Login.Enabled := False;
 MaskEdit1.Clear;
 MaskEdit1.SetFocus;
end;

procedure TFLogin.MaskEdit1KeyPress(Sender: TObject; var Key: Char);
begin
 If Key = #13 Then
 Begin
  If MaskEdit1.Text = '7g' then
  Begin
   Login.Enabled := True;
   Login.SetFocus;
  End
  Else
  Begin
   Application.MessageBox('Password Salah !', 'Warning !', MB_OK+MB_ICONWARNING);
   FormActivate(Sender);
  End;
 End;
end;

procedure TFLogin.LoginClick(Sender: TObject);
begin
 FOpen.ShowModal;
end;

procedure TFLogin.KeluarClick(Sender: TObject);
begin
 Application.Terminate;
end;

end.

Utama.pas

unit Utama;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, Buttons, jpeg, Menus, Grids, DBGrids, StdCtrls;

type
  TFUtama = class(TForm)
    Image1: TImage;
    MainMenu1: TMainMenu;
    Data1: TMenuItem;
    Peserta1: TMenuItem;
    Juri1: TMenuItem;
    N1: TMenuItem;
    Kategori1: TMenuItem;
    Klasifikasi1: TMenuItem;
    AudisiLomba1: TMenuItem;
    Nilai1: TMenuItem;
    Laporan1: TMenuItem;
    Keluar1: TMenuItem;
    DaftarPeserta1: TMenuItem;
    DaftarJuri1: TMenuItem;
    N3: TMenuItem;
    DaftarNilai1: TMenuItem;
    KategoriPerJuri1: TMenuItem;
    KlasifikasiPerJuri1: TMenuItem;
    NilaiKeseluruhan1: TMenuItem;
    TotalNilai1: TMenuItem;
    DaftarLulusAudisi1: TMenuItem;
    DaftarKategoriKlasifikasi1: TMenuItem;
    Audisi1: TMenuItem;
    N2: TMenuItem;
    TransferPeserta1: TMenuItem;
    AnalisisNilaiPemenang1: TMenuItem;
    KomunitasTerbaik3: TMenuItem;
    KategoriTerbaik3: TMenuItem;
    DaftarJuara1: TMenuItem;
    LogOut1: TMenuItem;
    Keluar2: TMenuItem;
    procedure NilaiKomunitas;
    procedure SeleksiAudisi;
    procedure Peserta1Click(Sender: TObject);
    procedure Juri1Click(Sender: TObject);
    procedure Kategori1Click(Sender: TObject);
    procedure Klasifikasi1Click(Sender: TObject);
    procedure Nilai1Click(Sender: TObject);
    procedure DaftarKategoriKlasifikasi1Click(Sender: TObject);
    procedure DaftarPeserta1Click(Sender: TObject);
    procedure DaftarJuri1Click(Sender: TObject);
    procedure KategoriPerJuri1Click(Sender: TObject);
    procedure KlasifikasiPerJuri1Click(Sender: TObject);
    procedure NilaiKeseluruhan1Click(Sender: TObject);
    procedure TotalNilai1Click(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure Audisi1Click(Sender: TObject);
    procedure TransferPeserta1Click(Sender: TObject);
    procedure DaftarLulusAudisi1Click(Sender: TObject);
    procedure KomunitasTerbaik3Click(Sender: TObject);
    procedure KategoriTerbaik3Click(Sender: TObject);
    procedure DaftarJuara1Click(Sender: TObject);
    procedure Keluar2Click(Sender: TObject);
    procedure LogOut1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    KdAudisi, Kategori : String;
    Quota : Byte;
  end;

var
  FUtama: TFUtama;

implementation

uses UAudisi, Peserta, Juri, Kategori, PilKategori, PilPeserta, Modul,
  DafKategori, DB, DafPeserta, DafJuri, PilJuri, DafNilaiKeseluruhan,
  DafNilaiTotal, DBTables, Quota, JuaraKomunitas, JuaraPeserta,
  SeleksiAudisi, PilAudisi2, DafNilaiJuaraKomunitas, PilJuaraKategori,
  DafJuara, UnitAudisi;

{$R *.dfm}

procedure TFUtama.SeleksiAudisi;
Var I, J, K, L, Z, Y, Batas : byte;
    CekNilai : Real;
    Nomor     : Array [1..300] Of String;
    Komunitas : Array [1..300] Of String;
    Nilai     : Array [1..300] Of Real;
    NomorSeri : Array [1..300] Of String;
    KomunitasSeri : Array [1..300] Of String;
    NilaiSeri     : Array [1..300] Of Real;
begin
 With Dm.QAudisi do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select * From Audisi Where Kd_Audisi ="'+FUtama.KdAudisi+'" ');
  Prepare;
  Open;
 End;

 With Dm.QNilai4 do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select b.no_peserta, b.nm_komunitas, sum(a.total), a.kd_audisi ');
  Sql.add('From nilai a, peserta b Where a.kd_peserta=b.kd_peserta ');
  Sql.add('And a.kd_audisi ="'+FUtama.KdAudisi+'" ');
  Sql.add('Group By b.no_peserta, b.nm_komunitas, a.kd_audisi');
  Prepare;
  Open;
 End;
 Batas := Dm.QNilai4.RecordCount;

 With Dm.QTempSeleksi do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Delete From TempSeleksi ');
  Prepare;
  ExecSQL;
 End;

 Dm.QNilai4.First;
 For I := 1 To Dm.QNilai4.RecordCount Do
 Begin
  Dm.TempSeleksi.Open;
  Dm.TempSeleksi.Append;
  Dm.TempSeleksiNo.Value := I;
  Dm.TempSeleksiNomor.Value := Dm.QNilai4no_peserta.Value;
  Dm.TempSeleksiKomunitas.Value := Dm.QNilai4nm_komunitas.Value;
  Dm.TempSeleksiNilai.Value := Dm.QNilai4SUMOFtotal.Value;
  Dm.TempSeleksi.Post;
  Dm.TempSeleksi.Refresh;
  Dm.QNilai4.Next;
 End;

 //Proses mencari nilai yang sama
 With Dm.QTempSeleksi2 do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select Nilai From TempSeleksi Group By Nilai Order by nilai desc');
  Prepare;
  Open;
 End;

 Z := 1;
 //Proses Pengurutan Nilai Descending
 Dm.QTempSeleksi2.First;
 For I := 1 To Dm.QTempSeleksi2.RecordCount Do
 Begin
  With Dm.QTempSeleksi do
  Begin
   Close;
   Sql.Clear;
   Sql.add('Select * From TempSeleksi Where Nilai = "'+FloatToStr(Dm.QTempSeleksi2nilai.Value)+'" ');
   Prepare;
   Open;
  End;

  //----Jika Nilai hanya memiliki satu alternatif saja----
  If Dm.QTempSeleksi.RecordCount = 1 Then
  Begin
   Nomor[Z]     := Dm.QTempSeleksiNomor.Value;
   Komunitas[Z] := Dm.QTempSeleksiKomunitas.Value;
   Nilai[Z]     := Dm.QTempSeleksiNilai.Value;
   Z := Z + 1;
  End
  Else
  Begin
   //---Jika Nilai memiliki lebih dari satu alternatif----

   //Proses pemindahan data seri ke tempseri
   With Dm.QTempSeri do
   Begin
    Close;
    Sql.Clear;
    Sql.add('Delete From TempSeri ');
    Prepare;
    ExecSQL;
   End;

   Dm.QTempSeleksi.First;
   For L := 1 To Dm.QTempSeleksi.RecordCount Do
   Begin
    Dm.TempSeri.Open;
    Dm.TempSeri.Append;
    Dm.TempSeriNomor.Value := Dm.QTempSeleksiNomor.Value;
    Dm.TempSeriKomunitas.Value := Dm.QTempSeleksiKomunitas.Value;
    Dm.TempSeriNilai.Value := Dm.QTempSeleksiNilai.Value;
    Dm.TempSeri.Post;
    Dm.TempSeri.Refresh;
    Dm.QTempSeleksi.Next;
   End;

   //Proses pengurutan bobot descending
   With Dm.QKategori do
   Begin
    Close;
    Sql.Clear;
    Sql.add('Select * From Kategori Where Kd_Audisi ="'+FUtama.KdAudisi+'" Order By Bobot Desc');
    Prepare;
    Open;
   End;

   //Proses pencarian nilai terbesar dari bobot terbesar
   Dm.QKategori.First;
   For J := 1 To Dm.QKategori.RecordCount Do
   Begin
    CekNilai := 0;
    Y := 0;
    Dm.TempSeri.First;
    For K := 1 To Dm.TempSeri.RecordCount Do
    Begin
     With Dm.QTempSeri do
     Begin
      Close;
      Sql.Clear;
      Sql.add('Select c.no_peserta, c.nm_komunitas, sum(a.nilai) ');
      Sql.add('From dtnilai a, nilai b, peserta c, klasifikasi d, kategori e ');
      Sql.add('Where a.kd_nilai=b.kd_nilai and b.kd_peserta=c.kd_peserta ');
      Sql.add('and a.kd_klasifikasi=d.kd_klasifikasi and d.kd_kategori=e.kd_kategori ');
      Sql.add('and kd_audisi="'+FUtama.KdAudisi+'" and d.kd_kategori = "'+Dm.QKategoriKd_Kategori.Value+'" ');
      Sql.add('and no_peserta = "'+Dm.TempSeriNomor.Value+'" group by c.no_peserta, c.nm_komunitas ');
      Prepare;
      Open;
     End;

     If Dm.QTempSeriSUMOFnilai.Value > CekNilai Then
     Begin
      If Y = 0 Then
      Begin
       Nomor[Z]     := Dm.QTempSerino_peserta.Value;
       Komunitas[Z] := Dm.QTempSerinm_komunitas.Value;
       Nilai[Z]     := Dm.QTempSeriSUMOFnilai.Value;
       CekNilai     := Dm.QTempSeriSUMOFnilai.Value;
       Y := Y + 1;
      End
      Else
      Begin
       NomorSeri[Y]     := Nomor[Z];
       KomunitasSeri[Y] := Komunitas[Z];
       NilaiSeri[Y]     := Nilai[Z];
       Y := Y + 1;

       Nomor[Z]     := Dm.QTempSerino_peserta.Value;
       Komunitas[Z] := Dm.QTempSerinm_komunitas.Value;
       Nilai[Z]     := Dm.QTempSeriSUMOFnilai.Value;
       CekNilai     := Dm.QTempSeriSUMOFnilai.Value;
      End;
     End
     Else
     If Dm.QTempSeriSUMOFnilai.Value = CekNilai Then
     Begin
      Z := Z + 1;
      Nomor[Z]     := Dm.QTempSerino_peserta.Value;
      Komunitas[Z] := Dm.QTempSerinm_komunitas.Value;
      Nilai[Z]     := Dm.QTempSeriSUMOFnilai.Value;
     End
     Else
     Begin
      NomorSeri[Y]     := Dm.QTempSerino_peserta.Value;
      KomunitasSeri[Y] := Dm.QTempSerinm_komunitas.Value;
      NilaiSeri[Y]     := Dm.QTempSeriSUMOFnilai.Value;
      Y := Y + 1;
     End;
     Dm.TempSeri.Next;
    End;

    //Proses pemindahan data seri ke tempseri
    With Dm.QTempSeri do
    Begin
     Close;
     Sql.Clear;
     Sql.add('Delete From TempSeri ');
     Prepare;
     ExecSQL;
    End;

    If Y <> 0 Then
    Begin
     For L := 1 To Y-1 Do
     Begin
      With Dm.QTempSeri2 do
      Begin
       Close;
       Sql.Clear;
       Sql.add('Select * From TempSeri Where nomor = "'+NomorSeri[L]+'" ');
       Prepare;
       Open;
      End;

      If Dm.QTempSeri2.RecordCount = 0 Then
      Begin
       Dm.TempSeri.Open;
       Dm.TempSeri.Append;
       Dm.TempSeriNomor.Value := NomorSeri[L];
       Dm.TempSeriKomunitas.Value := KomunitasSeri[L];
       Dm.TempSeriNilai.Value := NilaiSeri[L];
       Dm.TempSeri.Post;
       Dm.TempSeri.Refresh;
      End;
     End;
    End;
    Z := Z + 1;
    Dm.QKategori.Next;
   End;
   Z := Z - 1;
  End;
  Dm.QTempSeleksi2.Next;
 End;

 With Dm.QTempSeleksi do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Delete From TempSeleksi ');
  Prepare;
  ExecSQL;
 End;

 //For L := 1 To FUtama.Quota Do
 For L := 1 To Batas+1 Do
 Begin
  Dm.TempSeleksi.Open;
  Dm.TempSeleksi.Append;
  Dm.TempSeleksiNo.Value := L;
  Dm.TempSeleksiNomor.Value := Nomor[L];
  Dm.TempSeleksiKomunitas.Value := Komunitas[L];
  Dm.TempSeleksiNilai.Value := Nilai[L];
  If Nilai[L] >= 100 Then
   Dm.TempSeleksiKriteria.Value := 'B'
  Else
  If (Nilai[L] >= 50) Or (Nilai[L] < 100) Then
   Dm.TempSeleksiKriteria.Value := 'C'
  Else
  If Nilai[L] < 50 Then
   Dm.TempSeleksiKriteria.Value := 'K';
  Dm.TempSeleksi.Post;
  Dm.TempSeleksi.Refresh;
 End;

 With Dm.QTempSeleksi do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Delete From TempSeleksi where nomor = "" ');
  Prepare;
  ExecSQL;
 End;

 Dm.TempSeleksi.First;
 For L := 1 To Dm.TempSeleksi.RecordCount Do
 Begin
  With Dm.QNilai4 do
  Begin
   Close;
   Sql.Clear;
   Sql.add('Select b.no_peserta, b.nm_komunitas, sum(a.total), a.kd_audisi ');
   Sql.add('From nilai a, peserta b Where a.kd_peserta=b.kd_peserta ');
   Sql.add('And a.kd_audisi ="'+FUtama.KdAudisi+'" and b.no_peserta= "'+Dm.TempSeleksiNomor.Value+'" ');
   Sql.add('Group By b.no_peserta, b.nm_komunitas, a.kd_audisi');
   Prepare;
   Open;
  End;

  Dm.TempSeleksi.Edit;
  Dm.TempSeleksiNilai.Value := Dm.QNilai4SUMOFtotal.Value;
  Dm.TempSeleksi.Post;
  Dm.TempSeleksi.Refresh;

  Dm.TempSeleksi.Next;
 End;

 With Dm.QTempSeleksi do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select * From TempSeleksi Order by nilai desc');
  Prepare;
  Open;
 End;
end;

procedure TFUtama.Peserta1Click(Sender: TObject);
begin
 FPeserta.ShowModal;
end;

procedure TFUtama.Juri1Click(Sender: TObject);
begin
 FJuri.ShowModal;
end;

procedure TFUtama.Kategori1Click(Sender: TObject);
begin
 FKategori.ShowModal;
end;

procedure TFUtama.Klasifikasi1Click(Sender: TObject);
begin
 FPilKategori.Pilih := 0;
 FPilKategori.ShowModal;
end;

procedure TFUtama.Nilai1Click(Sender: TObject);
begin
 FPilPeserta.Pil := 0;
 FPilPeserta.ShowModal;
end;

procedure TFUtama.DaftarKategoriKlasifikasi1Click(Sender: TObject);
begin
 With Dm.QAudisi do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select * From Audisi Where Kd_Audisi ="'+FUtama.KdAudisi+'" ');
  Prepare;
  Open;
 End;

 With Dm.QKategori do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select * From Kategori Where Kd_Audisi ="'+FUtama.KdAudisi+'" ');
  Prepare;
  Open;
 End;

 If Dm.QKategori.RecordCount = 0 Then
  Application.MessageBox('Data Kosong!', 'Informasi !', MB_OK+MB_ICONINFORMATION)
 Else
 Begin
  QrKategori.QRLabel12.Caption := Dm.QAudisiNm_Audisi.Value;
  QrKategori.QRLabel13.Caption := DateToStr(Dm.QAudisiTanggal.Value);
  QrKategori.QRLabel14.Caption := Dm.QAudisiTempat.Value;
  QrKategori.Preview;
 End;
end;

procedure TFUtama.DaftarPeserta1Click(Sender: TObject);
begin
 With Dm.QAudisi do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select * From Audisi Where Kd_Audisi ="'+FUtama.KdAudisi+'" ');
  Prepare;
  Open;
 End;

 With Dm.QPeserta do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select * From Peserta Where Kd_Audisi ="'+FUtama.KdAudisi+'" Order By No_Peserta');
  Prepare;
  Open;
 End;

 If Dm.QPeserta.RecordCount = 0 Then
  Application.MessageBox('Data Kosong!', 'Informasi !', MB_OK+MB_ICONINFORMATION)
 Else
 Begin
  QrPeserta.QRLabel12.Caption := Dm.QAudisiNm_Audisi.Value;
  QrPeserta.QRLabel13.Caption := DateToStr(Dm.QAudisiTanggal.Value);
  QrPeserta.QRLabel14.Caption := Dm.QAudisiTempat.Value;
  QrPeserta.Preview;
 End;
end;

procedure TFUtama.DaftarJuri1Click(Sender: TObject);
begin
 With Dm.QAudisi do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select * From Audisi Where Kd_Audisi ="'+FUtama.KdAudisi+'" ');
  Prepare;
  Open;
 End;

 With Dm.QJuri do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select * From Juri Where Kd_Audisi ="'+FUtama.KdAudisi+'" Order By Nm_Juri');
  Prepare;
  Open;
 End;

 If Dm.QJuri.RecordCount = 0 Then
  Application.MessageBox('Data Kosong!', 'Informasi !', MB_OK+MB_ICONINFORMATION)
 Else
 Begin
  QrJuri.QRLabel12.Caption := Dm.QAudisiNm_Audisi.Value;
  QrJuri.QRLabel13.Caption := DateToStr(Dm.QAudisiTanggal.Value);
  QrJuri.QRLabel14.Caption := Dm.QAudisiTempat.Value;
  QrJuri.Preview;
 End;
end;

procedure TFUtama.KategoriPerJuri1Click(Sender: TObject);
begin
 FPilJuri.Pil := 0;
 FPilJuri.ShowModal;
end;

procedure TFUtama.KlasifikasiPerJuri1Click(Sender: TObject);
begin
 FPilJuri.Pil := 1;
 FPilJuri.ShowModal;
end;

procedure TFUtama.NilaiKeseluruhan1Click(Sender: TObject);
begin
 With Dm.QAudisi do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select * From Audisi Where Kd_Audisi ="'+FUtama.KdAudisi+'" ');
  Prepare;
  Open;
 End;

 With Dm.QPeserta do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select * From Peserta Where Kd_Audisi ="'+FUtama.KdAudisi+'" Order By No_Peserta');
  Prepare;
  Open;
 End;

 QrNilaiKeseluruhan.QRLabel12.Caption := Dm.QAudisiNm_Audisi.Value;
 QrNilaiKeseluruhan.QRLabel13.Caption := DateToStr(Dm.QAudisiTanggal.Value);
 QrNilaiKeseluruhan.QRLabel14.Caption := Dm.QAudisiTempat.Value;
 QrNilaiKeseluruhan.Preview;
end;

procedure TFUtama.TotalNilai1Click(Sender: TObject);
Var I : Byte;
begin
 With Dm.QAudisi do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select * From Audisi Where Kd_Audisi ="'+FUtama.KdAudisi+'" ');
  Prepare;
  Open;
 End;

 With Dm.QNilai4 do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select b.no_peserta, b.nm_komunitas, sum(a.total), a.kd_audisi ');
  Sql.add('From nilai a, peserta b Where a.kd_peserta=b.kd_peserta ');
  Sql.add('And a.kd_audisi ="'+FUtama.KdAudisi+'" ');
  Sql.add('Group By b.no_peserta, b.nm_komunitas, a.kd_audisi');
  Prepare;
  Open;
 End;

 With Dm.QTempSeleksi do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Delete From TempSeleksi ');
  Prepare;
  ExecSQL;
 End;

 Dm.QNilai4.First;
 For I := 1 To Dm.QNilai4.RecordCount Do
 Begin
  Dm.TempSeleksi.Open;
  Dm.TempSeleksi.Append;
  Dm.TempSeleksiNo.Value := I;
  Dm.TempSeleksiNomor.Value := Dm.QNilai4no_peserta.Value;
  Dm.TempSeleksiKomunitas.Value := Dm.QNilai4nm_komunitas.Value;
  Dm.TempSeleksiNilai.Value := Dm.QNilai4SUMOFtotal.Value;
  Dm.TempSeleksi.Post;
  Dm.TempSeleksi.Refresh;
  Dm.QNilai4.Next;
 End;

 With Dm.QTempSeleksi do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select * From TempSeleksi Order by nilai desc');
  Prepare;
  Open;
 End;

 QrNilaiTotal.QRLabel21.Enabled := False;
 QrNilaiTotal.QRLabel22.Enabled := False;
 QrNilaiTotal.QRLabel23.Enabled := False;
 QrNilaiTotal.QRDBText4.Enabled := False;

 QrNilaiTotal.QRLabel1.Caption := 'DAFTAR TOTAL NILAI';
 QrNilaiTotal.QRLabel12.Caption := Dm.QAudisiNm_Audisi.Value;
 QrNilaiTotal.QRLabel13.Caption := DateToStr(Dm.QAudisiTanggal.Value);
 QrNilaiTotal.QRLabel14.Caption := Dm.QAudisiTempat.Value;
 QrNilaiTotal.Preview;
end;

procedure TFUtama.FormActivate(Sender: TObject);
begin
 If Kategori = '0' Then
 Begin
  DaftarLulusAudisi1.Enabled := True;
  AnalisisNilaiPemenang1.Enabled := False;
  DaftarJuara1.Enabled := False;
  Klasifikasi1.Enabled := False;
 End
 Else
 Begin
  DaftarLulusAudisi1.Enabled := False;
  AnalisisNilaiPemenang1.Enabled := True;
  DaftarJuara1.Enabled := True;
  Klasifikasi1.Enabled := True;
 End;
end;

procedure TFUtama.Audisi1Click(Sender: TObject);
begin
 FormAudisi.Status:= '1';
 FormAudisi.ShowModal;
end;

procedure TFUtama.TransferPeserta1Click(Sender: TObject);
Var NilaiLulus : Integer;
begin
 SeleksiAudisi;
 //Mencari jumlah juri
 With Dm.QJuri do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select * From Juri Where Kd_Audisi ="'+FUtama.KdAudisi+'" Order By Nm_Juri');
  Prepare;
  Open;
 End;

 IF Dm.QJuri.RecordCount = 1 Then NilaiLulus := 50
  Else IF Dm.QJuri.RecordCount = 2 Then NilaiLulus := 100
   Else IF Dm.QJuri.RecordCount = 3 Then NilaiLulus := 150
    Else IF Dm.QJuri.RecordCount = 4 Then NilaiLulus := 200
     Else NilaiLulus := 250;

 If Kategori = '0' Then
 Begin
  With Dm.QTempSeleksi do
  Begin
   Close;
   Sql.Clear;
   Sql.add('Select * From TempSeleksi where Nilai >= "'+IntToStr(NilaiLulus)+'" Order by nilai desc');
   Prepare;
   Open;
  End;
 End
 Else
 Begin
  With Dm.QTempSeleksi do
  Begin
   Close;
   Sql.Clear;
   Sql.add('Select * From TempSeleksi Order by nilai desc');
   Prepare;
   Open;
  End;
 End;

 FSeleksiAudisi.ShowModal;
end;

procedure TFUtama.DaftarLulusAudisi1Click(Sender: TObject);
Var I : Byte;
begin
 SeleksiAudisi;

 With Dm.QTempSeleksi do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select * From TempSeleksi Order by nilai desc');
  Prepare;
  Open;
 End;
 Dm.QTempSeleksi.First;
 For I := 1 To Dm.QTempSeleksi.RecordCount Do
 Begin
  If Dm.QTempSeleksi.RecNo = FUtama.Quota Then
   QrNilaiTotal.NilaiBatas := Dm.QTempSeleksiNilai.Value;
  Dm.QTempSeleksi.Next;
 End;

 QrNilaiTotal.QRLabel21.Enabled := True;
 QrNilaiTotal.QRLabel22.Enabled := True;
 QrNilaiTotal.QRLabel23.Enabled := True;
 QrNilaiTotal.QRDBText4.Enabled := True;

 QrNilaiTotal.QRLabel1.Caption := 'DAFTAR PESERTA LULUS AUDISI';
 QrNilaiTotal.QRLabel12.Caption := Dm.QAudisiNm_Audisi.Value;
 QrNilaiTotal.QRLabel13.Caption := DateToStr(Dm.QAudisiTanggal.Value);
 QrNilaiTotal.QRLabel14.Caption := Dm.QAudisiTempat.Value;

 With Dm.QTempSeleksi do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select * From TempSeleksi Order by nilai desc');
  Prepare;
  Open;
 End;

 //Mencari jumlah juri
 With Dm.QJuri do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select * From Juri Where Kd_Audisi ="'+FUtama.KdAudisi+'" Order By Nm_Juri');
  Prepare;
  Open;
 End;
 QrNilaiTotal.JumJuri := Dm.QJuri.RecordCount;
 QrNilaiTotal.Preview;
end;

procedure TFUtama.NilaiKomunitas;
Var I, J : byte;
begin
 With Dm.QAudisi do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select * From Audisi Where Kategori = "1" Order By Tanggal ');
  Prepare;
  Open;
 End;

 With Dm.QTempSeleksi do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Delete From TempSeleksi ');
  Prepare;
  ExecSQL;
 End;

 Dm.QAudisi.First;
 For I := 1 To Dm.QAudisi.RecordCount Do
 Begin
  With Dm.QPeserta do
  Begin
   Close;
   Sql.Clear;
   Sql.add('Select * From Peserta Where Kd_Audisi ="'+Dm.QAudisiKd_Audisi.Value+'" Order By Kd_Peserta');
   Prepare;
   Open;
  End;

  Dm.QPeserta.First;
  For J := 1 To Dm.QPeserta.RecordCount Do
  Begin
   With Dm.QNilai4 do
   Begin
    Close;
    Sql.Clear;
    Sql.add('Select b.no_peserta, b.nm_komunitas, sum(a.total), a.kd_audisi ');
    Sql.add('From nilai a, peserta b Where a.kd_peserta=b.kd_peserta ');
    Sql.add('And a.kd_audisi ="'+Dm.QAudisiKd_Audisi.Value+'" and b.Nm_Komunitas = "'+Dm.QPesertaNm_Komunitas.Value+'"  ');
    Sql.add('Group By b.no_peserta, b.nm_komunitas, a.kd_audisi');
    Prepare;
    Open;
   End;

   With Dm.QTempSeleksi do
   Begin
    Close;
    Sql.Clear;
    Sql.add('Select * From TempSeleksi Where Komunitas = "'+Dm.QNilai4nm_komunitas.Value+'" ');
    Prepare;
    Open;
   End;

   If Dm.QTempSeleksi.RecordCount = 0 Then
   Begin
    Dm.TempSeleksi.Open;
    Dm.TempSeleksi.Append;
    Dm.TempSeleksiNo.Value := J;
    Dm.TempSeleksiNomor.Value := Dm.QNilai4no_peserta.Value;
    Dm.TempSeleksiKomunitas.Value := Dm.QNilai4nm_komunitas.Value;
    Dm.TempSeleksiNilai1.Value := Dm.QNilai4SUMOFtotal.Value;
    Dm.TempSeleksi.Post;
    Dm.TempSeleksi.Refresh;
   End
   Else
   Begin
    Dm.TempSeleksi.Open;
    Dm.TempSeleksi.FindNearest([Dm.QTempSeleksiNo.Value]);
    Dm.TempSeleksi.Edit;
    Dm.TempSeleksiNilai2.Value := Dm.QNilai4SUMOFtotal.Value;
    Dm.TempSeleksi.Post;
    Dm.TempSeleksi.Refresh;
   End;
   Dm.QPeserta.Next;
  End;
  Dm.QAudisi.Next;
 End;

 Dm.TempSeleksi.First;
 For I := 1 To Dm.TempSeleksi.RecordCount Do
 Begin
  Dm.TempSeleksi.Edit;
  Dm.TempSeleksiNilai.Value := Dm.TempSeleksiNilai1.Value + Dm.TempSeleksiNilai2.Value;
  Dm.TempSeleksiKriteria.Value := FloatToStr(Dm.TempSeleksiNilai2.Value-Dm.TempSeleksiNilai1.Value);
  Dm.TempSeleksi.Post;
  Dm.TempSeleksi.Refresh;
  Dm.TempSeleksi.Next;
 End;

 With Dm.QTempSeleksi do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select * From TempSeleksi Order by nilai desc, kriteria asc ');
  Prepare;
  Open;
 End;
end;

procedure TFUtama.KomunitasTerbaik3Click(Sender: TObject);
begin
 NilaiKomunitas;
 QrNilaiJuaraKomunitas.QRLabel12.Caption := Dm.QAudisiNm_Audisi.Value;
 QrNilaiJuaraKomunitas.QRLabel13.Caption := DateToStr(Dm.QAudisiTanggal.Value);
 QrNilaiJuaraKomunitas.QRLabel14.Caption := Dm.QAudisiTempat.Value;
 QrNilaiJuaraKomunitas.Preview;
end;

procedure TFUtama.KategoriTerbaik3Click(Sender: TObject);
begin
 FPilJuaraKategori.ShowModal;
end;

procedure TFUtama.DaftarJuara1Click(Sender: TObject);
begin
 NilaiKomunitas;

 With Dm.QAudisi do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select * From Audisi Where Kd_Audisi ="'+FUtama.KdAudisi+'" ');
  Prepare;
  Open;
 End;

 QrJuara.QRLabel1.Caption  := 'DAFTAR JUARA KOMUNITAS TERBAIK';
 QrJuara.QRLabel12.Caption := Dm.QAudisiNm_Audisi.Value;
 QrJuara.QRLabel13.Caption := DateToStr(Dm.QAudisiTanggal.Value);
 QrJuara.QRLabel14.Caption := Dm.QAudisiTempat.Value;
 QrJuara.Preview;
end;

procedure TFUtama.Keluar2Click(Sender: TObject);
begin
 Application.Terminate;
end;

procedure TFUtama.LogOut1Click(Sender: TObject);
begin
 Close;
end;

end.

Juri.pas

unit Juri;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, DBCtrls, Buttons, Mask, ExtCtrls;

type
  TFJuri = class(TForm)
    Bevel5: TBevel;
    Bevel1: TBevel;
    Bevel2: TBevel;
    Label1: TLabel;
    Label2: TLabel;
    Bevel4: TBevel;
    Label3: TLabel;
    Label5: TLabel;
    Label4: TLabel;
    DBEdit2: TDBEdit;
    Baru: TBitBtn;
    Simpan: TBitBtn;
    Edit: TBitBtn;
    Batal: TBitBtn;
    Keluar: TBitBtn;
    DBLookupComboBox1: TDBLookupComboBox;
    DBEdit1: TDBEdit;
    DBEdit3: TDBEdit;
    DBEdit4: TDBEdit;
    DBMemo1: TDBMemo;
    Hapus: TBitBtn;
    procedure Kode;
    procedure KeluarClick(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure BaruClick(Sender: TObject);
    procedure SimpanClick(Sender: TObject);
    procedure DBEdit2KeyPress(Sender: TObject; var Key: Char);
    procedure DBEdit3KeyPress(Sender: TObject; var Key: Char);
    procedure DBEdit4KeyPress(Sender: TObject; var Key: Char);
    procedure DBMemo1KeyPress(Sender: TObject; var Key: Char);
    procedure BatalClick(Sender: TObject);
    procedure DBLookupComboBox1Click(Sender: TObject);
    procedure EditClick(Sender: TObject);
    procedure HapusClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FJuri: TFJuri;
  Status : Byte;

implementation

uses Modul, Utama;

{$R *.dfm}

procedure TFJuri.KeluarClick(Sender: TObject);
begin
 Close;
end;

procedure TFJuri.Kode;
Var Kode1, Kode2 : String;
begin
 With Dm.QJuri do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select * From Juri Where Kd_Audisi ="'+FUtama.KdAudisi+'" Order By Kd_Juri');
  Prepare;
  Open;
 End;

 Dm.QJuri.Last;
 If Dm.QJuri.bof Then
  Kode1 := FUtama.KdAudisi+'-1'
 Else
 begin
  Kode2 := Inttostr (StrToInt(Copy(Dm.QJuriKd_Juri.Value, 8, 1)) + 1);
  Kode1 := FUtama.KdAudisi + '-' + Kode2;
 End;
 Dm.Juri.Append;
 Dm.JuriKd_Juri.Value := Kode1;
end;

procedure TFJuri.FormActivate(Sender: TObject);
begin
 DBEdit1.DataField := '';
 DBEdit2.DataField := '';
 DBEdit3.DataField := '';
 DBEdit4.DataField := '';
 DBMemo1.DataField := '';
 Baru.Enabled := True;
 Simpan.Enabled := False;
 Edit.Enabled := True;
 Keluar.Enabled := True;
 Batal.Enabled := False;
 Hapus.Enabled := True;
 DBEdit2.Visible := True;
 DBLookupComboBox1.Visible := False;
 Baru.SetFocus;
end;

procedure TFJuri.BaruClick(Sender: TObject);
begin
 DBEdit1.DataField := 'Kd_Juri';
 DBEdit2.DataField := 'Nm_Juri';
 DBEdit3.DataField := 'Alamat';
 DBEdit4.DataField := 'Telp';
 DBMemo1.DataField := 'Biografi';
 Kode;
 DBEdit2.SetFocus;
 Baru.Enabled := False;
 Simpan.Enabled := False;
 Edit.Enabled := False;
 Batal.Enabled := True;
 Keluar.Enabled := False;
 Hapus.Enabled := False;
end;

procedure TFJuri.SimpanClick(Sender: TObject);
begin
 If ((DBEdit1.Text = '') Or (DBEdit2.Text = '') Or (DBEdit3.Text = '') Or (DBEdit4.Text = '') Or (DBMemo1.Text = '') ) Then
 Begin
  Application.MessageBox('Data Tidak Boleh Kosong !', 'Warning !', MB_OK+MB_ICONWARNING);
  Exit;
 End
 Else
 Begin
  Dm.Juri.Open;
  Dm.JuriKd_Audisi.Value := FUtama.KdAudisi;
  Dm.Juri.Post;
  Dm.Juri.Refresh;
  FormActivate(Sender);
 End;
end;

procedure TFJuri.DBEdit2KeyPress(Sender: TObject; var Key: Char);
begin
 If Key = #13 Then DBEdit3.SetFocus;
end;

procedure TFJuri.DBEdit3KeyPress(Sender: TObject; var Key: Char);
begin
 If Key = #13 Then DBEdit4.SetFocus;
end;

procedure TFJuri.DBEdit4KeyPress(Sender: TObject; var Key: Char);
begin
 If Key = #13 Then DBMemo1.SetFocus;
end;

procedure TFJuri.DBMemo1KeyPress(Sender: TObject; var Key: Char);
begin
 If Key = #13 Then
 Begin
  Simpan.Enabled := True;
  Simpan.SetFocus;
 End;
end;

procedure TFJuri.BatalClick(Sender: TObject);
begin
 Dm.Juri.Cancel;
 FormActivate(Sender);
end;

procedure TFJuri.DBLookupComboBox1Click(Sender: TObject);
begin
 Dm.Juri.FindNearest([Dm.QJuriKd_Juri.Value]);
 DBEdit1.DataField := 'Kd_Juri';
 DBEdit2.DataField := 'Nm_Juri';
 DBEdit3.DataField := 'Alamat';
 DBEdit4.DataField := 'Telp';
 DBMemo1.DataField := 'Biografi';
 DBLookupComboBox1.Visible := False;
 DBEdit2.Visible := True;
 DBEdit2.SetFocus;
 IF Status = 2 Then
 Begin
  IF Application.MessageBox('Yakin Data Akan Dihapus ?', 'Warning !', MB_YESNO+MB_ICONQUESTION) = IdYes Then
  Begin
   Dm.Juri.Delete;
   Application.MessageBox('Data Telah Dihapus !', 'Informasi !', MB_OK+MB_ICONINFORMATION);
   FormActivate(Sender);
  End
  Else
   FormActivate(Sender);
 End;
end;

procedure TFJuri.EditClick(Sender: TObject);
begin
 With Dm.QJuri do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select * From Juri Where Kd_Audisi ="'+FUtama.KdAudisi+'" Order By Kd_Juri');
  Prepare;
  Open;
 End;

 DBLookupComboBox1.Visible := True;
 DBEdit2.Visible := False;
 DBLookupComboBox1.SetFocus;
 Baru.Enabled := False;
 Simpan.Enabled := True;
 Edit.Enabled := False;
 Batal.Enabled := True;
 Keluar.Enabled := False;
 Hapus.Enabled := False;
 Status := 1;
end;

procedure TFJuri.HapusClick(Sender: TObject);
begin
 With Dm.QJuri do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select * From Juri Where Kd_Audisi ="'+FUtama.KdAudisi+'" Order By Kd_Juri');
  Prepare;
  Open;
 End;

 DBLookupComboBox1.Visible := True;
 DBEdit2.Visible := False;
 DBLookupComboBox1.SetFocus;
 Baru.Enabled := False;
 Simpan.Enabled := True;
 Edit.Enabled := False;
 Batal.Enabled := True;
 Keluar.Enabled := False;
 Hapus.Enabled := False;
 Status := 2;
end;

end.

Kategori.pas

unit Kategori;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, DBCtrls, Mask, Buttons, ExtCtrls, Grids, DBGrids;

type
  TFKategori = class(TForm)
    Bevel5: TBevel;
    Bevel1: TBevel;
    Bevel2: TBevel;
    Label1: TLabel;
    Label2: TLabel;
    Bevel4: TBevel;
    Label3: TLabel;
    Baru: TBitBtn;
    Simpan: TBitBtn;
    Edit: TBitBtn;
    Batal: TBitBtn;
    Keluar: TBitBtn;
    DBLookupComboBox1: TDBLookupComboBox;
    DBEdit1: TDBEdit;
    DBEdit3: TDBEdit;
    DBEdit2: TDBEdit;
    Label4: TLabel;
    Hapus: TBitBtn;
    procedure Kode;
    procedure KodeKlasifikasi;
    procedure KeluarClick(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure BaruClick(Sender: TObject);
    procedure SimpanClick(Sender: TObject);
    procedure DBEdit2KeyPress(Sender: TObject; var Key: Char);
    procedure DBEdit3KeyPress(Sender: TObject; var Key: Char);
    procedure BatalClick(Sender: TObject);
    procedure DBLookupComboBox1Click(Sender: TObject);
    procedure EditClick(Sender: TObject);
    procedure HapusClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FKategori: TFKategori;
  Status : Byte;

implementation

uses Modul, Utama, DB;

{$R *.dfm}

procedure TFKategori.KeluarClick(Sender: TObject);
begin
 Close;
end;

procedure TFKategori.Kode;
Var Kode1, Kode2 : String;
begin
 With Dm.QKategori do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select * From Kategori Where Kd_Audisi ="'+FUtama.KdAudisi+'" Order By Kd_Kategori');
  Prepare;
  Open;
 End;

 Dm.QKategori.Last;
 If Dm.QKategori.bof Then
  Kode1 := FUtama.KdAudisi+'-1'
 Else
 begin
  Kode2 := Inttostr (StrToInt(Copy(Dm.QKategoriKd_Kategori.Value, 8, 1)) + 1);
  Kode1 := FUtama.KdAudisi + '-' + Kode2;
 End;
 Dm.Kategori.Append;
 Dm.KategoriKd_Kategori.Value := Kode1;
end;

procedure TFKategori.KodeKlasifikasi;
Var Kode1, Kode2 : String;
begin
 With Dm.QKlasifikasi do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select * From Klasifikasi Where Kd_Kategori ="'+DBEdit1.Text+'" Order By Kd_Klasifikasi');
  Prepare;
  Open;
 End;

 Dm.QKlasifikasi.Last;
 If Dm.QKlasifikasi.bof Then
 Kode1 := DBEdit1.Text+'-1'
 Else
 begin
  Kode2 := Inttostr (StrToInt(Copy(Dm.QKlasifikasiKd_Klasifikasi.Value, 10, 1)) + 1);
  Kode1 := DBEdit1.Text + '-' + Kode2;
 End;
 Dm.Klasifikasi.Append;
 Dm.KlasifikasiKd_Klasifikasi.Value := Kode1;
end;

procedure TFKategori.FormActivate(Sender: TObject);
begin
 DBEdit1.DataField := '';
 DBEdit2.DataField := '';
 DBEdit3.DataField := '';
 Baru.Enabled := True;
 Simpan.Enabled := False;
 Edit.Enabled := True;
 Keluar.Enabled := True;
 Batal.Enabled := False;
 Hapus.Enabled := True;
 DBEdit2.Visible := True;
 DBLookupComboBox1.Visible := False;
 Baru.SetFocus;
end;

procedure TFKategori.BaruClick(Sender: TObject);
begin
 DBEdit1.DataField := 'Kd_Kategori';
 DBEdit2.DataField := 'Nm_Kategori';
 DBEdit3.DataField := 'Bobot';
 Kode;
 DBEdit2.SetFocus;
 Baru.Enabled := False;
 Simpan.Enabled := False;
 Edit.Enabled := False;
 Batal.Enabled := True;
 Keluar.Enabled := False;
 Hapus.Enabled := False;
end;

procedure TFKategori.SimpanClick(Sender: TObject);
begin
 If ((DBEdit1.Text = '') Or (DBEdit2.Text = '') Or (DBEdit3.Text = '')) Then
 Begin
  Application.MessageBox('Data Tidak Boleh Kosong !', 'Warning !', MB_OK+MB_ICONWARNING);
  Exit;
 End
 Else
 Begin
  Dm.Kategori.Open;
  Dm.KategoriKd_Audisi.Value := FUtama.KdAudisi;
  Dm.Kategori.Post;
  Dm.Kategori.Refresh;
  If FUtama.Kategori = '0' Then
  Begin
   KodeKlasifikasi;
   Dm.KlasifikasiNm_Klasifikasi.Value := DBEdit2.Text;
   Dm.KlasifikasiKd_Kategori.Value := DBEdit1.Text;
   Dm.Klasifikasi.Post;
   Dm.Klasifikasi.Refresh;
  End;
  FormActivate(Sender);
 End;
end;

procedure TFKategori.DBEdit2KeyPress(Sender: TObject; var Key: Char);
begin
 If Key = #13 Then
 Begin
  With Dm.QKategori do
  Begin
   Close;
   Sql.Clear;
   Sql.add('Select * From Kategori Where Kd_Audisi ="'+FUtama.KdAudisi+'" and Nm_Kategori ="'+DBEdit2.Text+'" ');
   Prepare;
   Open;
  End;

  IF Dm.QKategori.RecordCount = 0 Then
   DBEdit3.SetFocus
  Else
  Begin
   Application.MessageBox('Data Sudah Ada !', 'Warning !', MB_OK+MB_ICONWARNING);
   DBEdit2.SetFocus;
  End;
 end;
end;

procedure TFKategori.DBEdit3KeyPress(Sender: TObject; var Key: Char);
Var I : Byte;
   Tot : Real;
begin
 If Key = #13 Then
 Begin
  With Dm.QKategori do
  Begin
   Close;
   Sql.Clear;
   Sql.add('Select * From Kategori Where Kd_Audisi ="'+FUtama.KdAudisi+'" Order By Kd_Kategori');
   Prepare;
   Open;
  End;

  Tot := 0;
  Dm.QKategori.First;
  For I := 1 To Dm.QKategori.RecordCount Do
  Begin
   Tot := Tot + Dm.QKategoriBobot.Value;
   Dm.QKategori.Next;
  End;
  Tot := Tot + StrToFloat(DBEdit3.Text);
  If Tot > 100 Then
  Begin
   Application.MessageBox('Bobot Melebihi 100 % !', 'Warning !', MB_OK+MB_ICONWARNING);
   DBEdit3.SetFocus;
  End
  Else
  Begin
   Simpan.Enabled := True;
   Simpan.SetFocus;
  End;
 End;
end;

procedure TFKategori.BatalClick(Sender: TObject);
begin
 Dm.Kategori.Cancel;
 FormActivate(Sender);
end;

procedure TFKategori.DBLookupComboBox1Click(Sender: TObject);
begin
 Dm.Kategori.FindNearest([Dm.QKategoriKd_Kategori.Value]);
 DBEdit1.DataField := 'Kd_Kategori';
 DBEdit2.DataField := 'Nm_Kategori';
 DBEdit3.DataField := 'Bobot';
 DBLookupComboBox1.Visible := False;
 DBEdit2.Visible := True;
 DBEdit2.SetFocus;
 IF Status = 2 Then
 Begin
  IF Application.MessageBox('Yakin Data Akan Dihapus ?', 'Warning !', MB_YESNO+MB_ICONQUESTION) = IdYes Then
  Begin
   Dm.Kategori.Delete;
   Application.MessageBox('Data Telah Dihapus !', 'Informasi !', MB_OK+MB_ICONINFORMATION);
   FormActivate(Sender);
  End
  Else
   FormActivate(Sender);
 End;
end;

procedure TFKategori.EditClick(Sender: TObject);
begin
 With Dm.QKategori do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select * From Kategori Where Kd_Audisi ="'+FUtama.KdAudisi+'" Order By Kd_Kategori');
  Prepare;
  Open;
 End;

 DBLookupComboBox1.Visible := True;
 DBEdit2.Visible := False;
 DBLookupComboBox1.SetFocus;
 Baru.Enabled := False;
 Simpan.Enabled := True;
 Edit.Enabled := False;
 Batal.Enabled := True;
 Keluar.Enabled := False;
 Hapus.Enabled := False;
 Status := 1;
end;

procedure TFKategori.HapusClick(Sender: TObject);
begin
 With Dm.QKategori do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select * From Kategori Where Kd_Audisi ="'+FUtama.KdAudisi+'" Order By Kd_Kategori');
  Prepare;
  Open;
 End;

 DBLookupComboBox1.Visible := True;
 DBEdit2.Visible := False;
 DBLookupComboBox1.SetFocus;
 Baru.Enabled := False;
 Simpan.Enabled := True;
 Edit.Enabled := False;
 Batal.Enabled := True;
 Keluar.Enabled := False;
 Hapus.Enabled := False;
 Status := 2;
end;

end.

Klasifikasi.pas

unit Klasifikasi;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Mask, DBCtrls, Buttons, ExtCtrls;

type
  TFKlasifikasi = class(TForm)
    Bevel5: TBevel;
    Bevel1: TBevel;
    Bevel2: TBevel;
    Label1: TLabel;
    Label2: TLabel;
    Bevel4: TBevel;
    Baru: TBitBtn;
    Simpan: TBitBtn;
    Edit: TBitBtn;
    Batal: TBitBtn;
    Keluar: TBitBtn;
    DBLookupComboBox1: TDBLookupComboBox;
    DBEdit1: TDBEdit;
    DBEdit2: TDBEdit;
    Hapus: TBitBtn;
    procedure Kode;
    procedure KeluarClick(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure BaruClick(Sender: TObject);
    procedure SimpanClick(Sender: TObject);
    procedure DBEdit2KeyPress(Sender: TObject; var Key: Char);
    procedure BatalClick(Sender: TObject);
    procedure DBLookupComboBox1Click(Sender: TObject);
    procedure EditClick(Sender: TObject);
    procedure HapusClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    KdKategori : String;
  end;

var
  FKlasifikasi: TFKlasifikasi;
  Status : Byte;

implementation

uses Modul;

{$R *.dfm}

procedure TFKlasifikasi.KeluarClick(Sender: TObject);
begin
 Close;
end;

procedure TFKlasifikasi.Kode;
Var Kode1, Kode2 : String;
begin
 With Dm.QKlasifikasi do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select * From Klasifikasi Where Kd_Kategori ="'+KdKategori+'" Order By Kd_Klasifikasi');
  Prepare;
  Open;
 End;

 Dm.QKlasifikasi.Last;
 If Dm.QKlasifikasi.bof Then
 Kode1 := KdKategori+'-1'
 Else
 begin
  Kode2 := Inttostr (StrToInt(Copy(Dm.QKlasifikasiKd_Klasifikasi.Value, 10, 1)) + 1);
  Kode1 := KdKategori + '-' + Kode2;
 End;
 Dm.Klasifikasi.Append;
 Dm.KlasifikasiKd_Klasifikasi.Value := Kode1;
end;

procedure TFKlasifikasi.FormActivate(Sender: TObject);
begin
 DBEdit1.DataField := '';
 DBEdit2.DataField := '';
 Baru.Enabled := True;
 Simpan.Enabled := False;
 Edit.Enabled := True;
 Keluar.Enabled := True;
 Batal.Enabled := False;
 Hapus.Enabled := True;
 DBEdit2.Visible := True;
 DBLookupComboBox1.Visible := False;
 Baru.SetFocus;
end;

procedure TFKlasifikasi.BaruClick(Sender: TObject);
begin
 DBEdit1.DataField := 'Kd_Klasifikasi';
 DBEdit2.DataField := 'Nm_Klasifikasi';
 Kode;
 DBEdit2.SetFocus;
 Baru.Enabled := False;
 Simpan.Enabled := False;
 Edit.Enabled := False;
 Batal.Enabled := True;
 Keluar.Enabled := False;
 Hapus.Enabled := False;
end;

procedure TFKlasifikasi.SimpanClick(Sender: TObject);
begin
 If ((DBEdit1.Text = '') Or (DBEdit2.Text = '')) Then
 Begin
  Application.MessageBox('Data Tidak Boleh Kosong !', 'Warning !', MB_OK+MB_ICONWARNING);
  Exit;
 End
 Else
 Begin
  Dm.Klasifikasi.Open;
  Dm.KlasifikasiKd_Kategori.Value := KdKategori;
  Dm.Klasifikasi.Post;
  Dm.Klasifikasi.Refresh;
  FormActivate(Sender);
 End;
end;

procedure TFKlasifikasi.DBEdit2KeyPress(Sender: TObject; var Key: Char);
begin
 If Key = #13 Then
 Begin
  With Dm.QKlasifikasi do
  Begin
   Close;
   Sql.Clear;
   Sql.add('Select * From Klasifikasi Where Kd_Kategori ="'+KdKategori+'"  and Nm_Klasifikasi ="'+DBEdit2.Text+'" ');
   Prepare;
   Open;
  End;

  IF Dm.QKlasifikasi.RecordCount = 0 Then
  Begin
   Simpan.Enabled := True;
   Simpan.SetFocus
  End
  Else
  Begin
   Application.MessageBox('Data Sudah Ada !', 'Warning !', MB_OK+MB_ICONWARNING);
   DBEdit2.SetFocus;
  End;
 end;
end;

procedure TFKlasifikasi.BatalClick(Sender: TObject);
begin
 Dm.Klasifikasi.Cancel;
 FormActivate(Sender);
end;

procedure TFKlasifikasi.DBLookupComboBox1Click(Sender: TObject);
begin
 Dm.Klasifikasi.FindNearest([Dm.QKlasifikasiKd_Klasifikasi.Value]);
 DBEdit1.DataField := 'Kd_Klasifikasi';
 DBEdit2.DataField := 'Nm_Klasifikasi';
 DBLookupComboBox1.Visible := False;
 DBEdit2.Visible := True;
 DBEdit2.SetFocus;
 IF Status = 2 Then
 Begin
  IF Application.MessageBox('Yakin Data Akan Dihapus ?', 'Warning !', MB_YESNO+MB_ICONQUESTION) = IdYes Then
  Begin
   Dm.Klasifikasi.Delete;
   Application.MessageBox('Data Telah Dihapus !', 'Informasi !', MB_OK+MB_ICONINFORMATION);
   FormActivate(Sender);
  End
  Else
   FormActivate(Sender);
 End;
end;

procedure TFKlasifikasi.EditClick(Sender: TObject);
begin
 With Dm.QKlasifikasi do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select * From Klasifikasi Where Kd_Kategori ="'+KdKategori+'" Order By Kd_Klasifikasi');
  Prepare;
  Open;
 End;

 DBLookupComboBox1.Visible := True;
 DBEdit2.Visible := False;
 DBLookupComboBox1.SetFocus;
 Baru.Enabled := False;
 Simpan.Enabled := True;
 Edit.Enabled := False;
 Batal.Enabled := True;
 Keluar.Enabled := False;
 Hapus.Enabled := False;
 Status := 1;
end;

procedure TFKlasifikasi.HapusClick(Sender: TObject);
begin
 With Dm.QKlasifikasi do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select * From Klasifikasi Where Kd_Kategori ="'+KdKategori+'" Order By Kd_Klasifikasi');
  Prepare;
  Open;
 End;

 DBLookupComboBox1.Visible := True;
 DBEdit2.Visible := False;
 DBLookupComboBox1.SetFocus;
 Baru.Enabled := False;
 Simpan.Enabled := True;
 Edit.Enabled := False;
 Batal.Enabled := True;
 Keluar.Enabled := False;
 Hapus.Enabled := False;
 Status := 2;
end;

end.

Nilai.pas

unit Nilai;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, DBCtrls, Mask, Buttons, ExtCtrls, Grids, DBGrids;

type
  TFNilai = class(TForm)
    Bevel5: TBevel;
    Bevel1: TBevel;
    Bevel2: TBevel;
    Label1: TLabel;
    Label2: TLabel;
    Bevel4: TBevel;
    Label3: TLabel;
    Label5: TLabel;
    Label4: TLabel;
    Keluar: TBitBtn;
    MaskEdit1: TMaskEdit;
    MaskEdit2: TMaskEdit;
    Bevel3: TBevel;
    DBGrid1: TDBGrid;
    Bevel6: TBevel;
    DBLookupComboBox1: TDBLookupComboBox;
    MaskEdit3: TMaskEdit;
    MaskEdit4: TMaskEdit;
    TotalNilai: TLabel;
    Label6: TLabel;
    procedure QueryNilai;
    procedure QueryJuri;
    procedure QueryKlasifikasi;
    procedure KeluarClick(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure DBLookupComboBox1Click(Sender: TObject);
    procedure DBGrid1CellClick(Column: TColumn);
    procedure MaskEdit4KeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
  public
    { Public declarations }
    KdPeserta : String;
  end;

var
  FNilai: TFNilai;
  KdJuri, KdKategori : String;
  TestKarakter, I : Integer;
  Total : Real;

implementation

uses Modul, Utama, DB;

{$R *.dfm}

procedure TFNilai.QueryNilai;
Var KdNilai : String;
    TotNilai : Real;
begin
 With Dm.QNilai1 do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select a.kd_nilai, c.kd_juri, a.kd_klasifikasi, b. nm_klasifikasi, b.kd_kategori, d.nm_kategori, d.bobot, a.nilai, c.kd_audisi, c.kd_peserta ');
  Sql.add('From dtnilai a, klasifikasi b, nilai c, kategori d ');
  Sql.add('Where a.kd_klasifikasi=b.kd_klasifikasi and a.kd_nilai=c.kd_nilai and b.kd_kategori=d.kd_kategori ');
  Sql.add('and c.kd_juri = "'+KdJuri+'" and c.kd_audisi="'+FUtama.KdAudisi+'" and kd_peserta = "'+KdPeserta+'" ');
  Sql.add('Order By a.kd_klasifikasi  ');
  Prepare;
  Open;
 End;

 KdNilai := Dm.QNilai1kd_nilai.Value;
 Total := 0;
 Dm.QNilai1.First;
 For I := 1 To Dm.QNilai1.RecordCount Do
 Begin
  Total := Total + Dm.QNilai1NilaiBobot.Value;
  Dm.QNilai1.Next;
 End;

 TotalNilai.Caption := 'TOTAL : ' + FloatToStr(Total);

 If Dm.Nilai.Locate('Kd_Nilai', KdNilai, []) Then
 Begin
  Dm.Nilai.Edit;
  Dm.NilaiTotal.Value := Total;
  Dm.Nilai.Post;
  Dm.Nilai.Refresh;
 End;
end;

procedure TFNilai.QueryJuri;
begin
 With Dm.QJuri do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select * From Juri Where Kd_Audisi ="'+FUtama.KdAudisi+'" Order By Nm_Juri');
  Prepare;
  Open;
 End;
end;

procedure TFNilai.QueryKlasifikasi;
begin
 With Dm.QKlasifikasi do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select * From Klasifikasi a, Kategori b ');
  Sql.add('Where a.Kd_Kategori = b.Kd_Kategori and b.Kd_Audisi ="'+FUtama.KdAudisi+'" Order By a.Nm_Klasifikasi');
  Prepare;
  Open;
 End;
end;

procedure TFNilai.KeluarClick(Sender: TObject);
begin
 Close;
end;

procedure TFNilai.FormActivate(Sender: TObject);
begin
 TotalNilai.Caption := 'TOTAL : 0';
 MaskEdit3.Clear;
 MaskEdit4.Clear;
 QueryNilai;
 QueryJuri;
end;

procedure TFNilai.DBLookupComboBox1Click(Sender: TObject);
begin
 KdJuri := Dm.QJuriKd_Juri.Value;
 Dm.KdJuriX := Dm.QJuriKd_Juri.Value;
 QueryNilai;
end;

procedure TFNilai.DBGrid1CellClick(Column: TColumn);
begin
 KdKategori := Dm.QNilai1kd_kategori.Value;
 MaskEdit3.Text := Dm.QNilai1nm_klasifikasi.Value;
 MaskEdit4.Text := FloatToStr(Dm.QNilai1nilai.Value);
 MaskEdit4.SetFocus;
end;

procedure TFNilai.MaskEdit4KeyPress(Sender: TObject; var Key: Char);
begin
 IF Key = #13 Then
 Begin
  Try
   TestKarakter := StrToInt(MaskEdit4.Text);

   If StrToInt(MaskEdit4.Text) > 100 Then
   Begin
    Application.MessageBox('Nilai Tidak Boleh Lebih Dari 100 !', 'Kesalahan !', MB_OK+MB_ICONERROR);
    MaskEdit4.SetFocus;
   End
   Else
   Begin
    Dm.DtNilai.Open;
    If Dm.DtNilai.Locate('Kd_Nilai;Kd_Klasifikasi', VarArrayOf([Dm.QNilai1Kd_Nilai.Value, Dm.QNilai1kd_klasifikasi.Value]), []) Then
    Begin
     Dm.DtNilai.Edit;
     Dm.DtNilaiNilai.Value := StrToFloat(MaskEdit4.Text);
     Dm.DtNilai.Post;
     Dm.DtNilai.Refresh;
     FormActivate(Sender);
    End;
   End;
  Except
   Application.MessageBox('Salah Memasukkan Data !', 'Kesalahan !', MB_OK+MB_ICONERROR);
   MaskEdit4.SetFocus;
  end;
 end;
end;

end.

Peserta.pas

unit Peserta;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DBCtrls, StdCtrls, Buttons, Mask, ExtCtrls;

type
  TFPeserta = class(TForm)
    Bevel5: TBevel;
    Bevel1: TBevel;
    Bevel2: TBevel;
    Label1: TLabel;
    Label2: TLabel;
    Bevel4: TBevel;
    Label3: TLabel;
    Label5: TLabel;
    DBEdit2: TDBEdit;
    Baru: TBitBtn;
    Simpan: TBitBtn;
    Edit: TBitBtn;
    Batal: TBitBtn;
    Keluar: TBitBtn;
    DBLookupComboBox1: TDBLookupComboBox;
    DBEdit1: TDBEdit;
    DBEdit3: TDBEdit;
    DBEdit4: TDBEdit;
    Label4: TLabel;
    DBEdit5: TDBEdit;
    Label6: TLabel;
    DBEdit6: TDBEdit;
    Label7: TLabel;
    DBMemo1: TDBMemo;
    procedure Kode;
    procedure KeluarClick(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure BaruClick(Sender: TObject);
    procedure SimpanClick(Sender: TObject);
    procedure DBEdit2KeyPress(Sender: TObject; var Key: Char);
    procedure DBEdit3KeyPress(Sender: TObject; var Key: Char);
    procedure DBEdit4KeyPress(Sender: TObject; var Key: Char);
    procedure DBEdit5KeyPress(Sender: TObject; var Key: Char);
    procedure DBMemo1KeyPress(Sender: TObject; var Key: Char);
    procedure DBEdit6KeyPress(Sender: TObject; var Key: Char);
    procedure BatalClick(Sender: TObject);
    procedure DBLookupComboBox1Click(Sender: TObject);
    procedure EditClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FPeserta: TFPeserta;

implementation

uses Modul, Utama;

{$R *.dfm}

procedure TFPeserta.KeluarClick(Sender: TObject);
begin
 Close;
end;

procedure TFPeserta.Kode;
Var Kode1, Kode2 : String;
begin
 With Dm.QPeserta do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select * From Peserta Where Kd_Audisi ="'+FUtama.KdAudisi+'" Order By Kd_Peserta');
  Prepare;
  Open;
 End;

 Dm.QPeserta.Last;
 If Dm.QPeserta.bof Then
  Kode1 := FUtama.KdAudisi+'-001'
 Else
 begin
  Kode2 := Inttostr (StrToInt(Copy(Dm.QPesertaKd_Peserta.Value, 8, 3)) + 1);
  Kode1 := FUtama.KdAudisi + '-' + Copy ('000',1,3-Length(Kode2)) + Kode2;
 End;
 Dm.Peserta.Append;
 Dm.PesertaKd_Peserta.Value := Kode1;
end;

procedure TFPeserta.FormActivate(Sender: TObject);
begin
 DBEdit1.DataField := '';
 DBEdit2.DataField := '';
 DBEdit3.DataField := '';
 DBEdit4.DataField := '';
 DBEdit5.DataField := '';
 DBEdit6.DataField := '';
 DBMemo1.DataField := '';
 Baru.Enabled := True;
 Simpan.Enabled := False;
 Edit.Enabled := True;
 Keluar.Enabled := True;
 Batal.Enabled := False;
 DBEdit2.Visible := True;
 DBLookupComboBox1.Visible := False;
 Baru.SetFocus;
end;

procedure TFPeserta.BaruClick(Sender: TObject);
begin
 DBEdit1.DataField := 'Kd_Peserta';
 DBEdit2.DataField := 'Nm_Komunitas';
 DBEdit3.DataField := 'Institusi';
 DBEdit4.DataField := 'Alamat';
 DBEdit5.DataField := 'Telp';
 DBEdit6.DataField := 'No_Peserta';
 DBMemo1.DataField := 'Materi';
 Kode;
 DBEdit2.SetFocus;
 Baru.Enabled := False;
 Simpan.Enabled := False;
 Edit.Enabled := False;
 Batal.Enabled := True;
 Keluar.Enabled := False;
end;

procedure TFPeserta.SimpanClick(Sender: TObject);
begin
 If ((DBEdit1.Text = '') Or (DBEdit2.Text = '') Or (DBEdit3.Text = '') Or (DBEdit4.Text = '') Or
     (DBEdit5.Text = '') Or (DBEdit6.Text = '') Or (DBMemo1.Text = '') ) Then
 Begin
  Application.MessageBox('Data Tidak Boleh Kosong !', 'Warning !', MB_OK+MB_ICONWARNING);
  Exit;
 End
 Else
 Begin
  Dm.Peserta.Open;
  Dm.PesertaKd_Audisi.Value := FUtama.KdAudisi;
  Dm.Peserta.Post;
  Dm.Peserta.Refresh;
  FormActivate(Sender);
 End;
end;

procedure TFPeserta.DBEdit2KeyPress(Sender: TObject; var Key: Char);
begin
 If Key = #13 Then DBEdit3.SetFocus;
end;

procedure TFPeserta.DBEdit3KeyPress(Sender: TObject; var Key: Char);
begin
 If Key = #13 Then DBEdit4.SetFocus;
end;

procedure TFPeserta.DBEdit4KeyPress(Sender: TObject; var Key: Char);
begin
 If Key = #13 Then DBEdit5.SetFocus;
end;

procedure TFPeserta.DBEdit5KeyPress(Sender: TObject; var Key: Char);
begin
 If Key = #13 Then DBMemo1.SetFocus;
end;

procedure TFPeserta.DBMemo1KeyPress(Sender: TObject; var Key: Char);
begin
 If Key = #13 Then DBEdit6.SetFocus;
end;

procedure TFPeserta.DBEdit6KeyPress(Sender: TObject; var Key: Char);
begin
 If Key = #13 Then
 Begin
  With Dm.QPeserta do
  Begin
   Close;
   Sql.Clear;
   Sql.add('Select * From Peserta Where Kd_Audisi ="'+FUtama.KdAudisi+'" and No_Peserta = "'+DBEdit6.Text+'" ');
   Prepare;
   Open;
  End;

  IF Dm.QPeserta.RecordCount = 0 Then
  Begin
   Simpan.Enabled := True;
   Simpan.SetFocus;
  End
  Else
  Begin
   Application.MessageBox('Nomor Peserta Sudah Ada !', 'Warning !', MB_OK+MB_ICONWARNING);
   DBEdit6.SetFocus;
  End
 End;
end;

procedure TFPeserta.BatalClick(Sender: TObject);
begin
 Dm.Peserta.Cancel;
 FormActivate(Sender);
end;

procedure TFPeserta.DBLookupComboBox1Click(Sender: TObject);
begin
 Dm.Peserta.FindNearest([Dm.QPesertaKd_Peserta.Value]);
 DBEdit1.DataField := 'Kd_Peserta';
 DBEdit2.DataField := 'Nm_Komunitas';
 DBEdit3.DataField := 'Institusi';
 DBEdit4.DataField := 'Alamat';
 DBEdit5.DataField := 'Telp';
 DBEdit6.DataField := 'No_Peserta';
 DBMemo1.DataField := 'Materi';
 DBLookupComboBox1.Visible := False;
 DBEdit2.Visible := True;
 DBEdit2.SetFocus;
end;

procedure TFPeserta.EditClick(Sender: TObject);
begin
 With Dm.QPeserta do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select * From Peserta Where Kd_Audisi ="'+FUtama.KdAudisi+'" Order By Kd_Peserta');
  Prepare;
  Open;
 End;

 DBLookupComboBox1.Visible := True;
 DBEdit2.Visible := False;
 DBLookupComboBox1.SetFocus;
 Baru.Enabled := False;
 Simpan.Enabled := True;
 Edit.Enabled := False;
 Batal.Enabled := True;
 Keluar.Enabled := False;
end;

end.

DafJuara.pas

unit DafJuara;

interface

uses Windows, SysUtils, Messages, Classes, Graphics, Controls,
  StdCtrls, ExtCtrls, Forms, QuickRpt, QRCtrls, jpeg;

type
  TQrJuara = class(TQuickRep)
    TitleBand1: TQRBand;
    QRLabel1: TQRLabel;
    QRShape2: TQRShape;
    QRLabel6: TQRLabel;
    QRLabel7: TQRLabel;
    QRLabel8: TQRLabel;
    QRLabel9: TQRLabel;
    QRLabel10: TQRLabel;
    QRLabel11: TQRLabel;
    QRLabel12: TQRLabel;
    QRLabel13: TQRLabel;
    QRLabel14: TQRLabel;
    QRLabel5: TQRLabel;
    QRLabel16: TQRLabel;
    QRLabel17: TQRLabel;
    QRLabel20: TQRLabel;
    QRImage1: TQRImage;
    QRImage2: TQRImage;
    PageFooterBand1: TQRBand;
    QRSysData2: TQRSysData;
    QRLabel15: TQRLabel;
    QRLabel19: TQRLabel;
    ColumnHeaderBand1: TQRBand;
    QRLabel4: TQRLabel;
    QRLabel2: TQRLabel;
    QRBand1: TQRBand;
    QRDBText3: TQRDBText;
    QRDBText4: TQRDBText;
    QRSysData1: TQRSysData;
    QRLabel3: TQRLabel;
    procedure QRBand1BeforePrint(Sender: TQRCustomBand;
      var PrintBand: Boolean);
  private

  public

  end;

var
  QrJuara: TQrJuara;

implementation

uses Modul;

{$R *.DFM}

procedure TQrJuara.QRBand1BeforePrint(Sender: TQRCustomBand;
  var PrintBand: Boolean);
begin
 If Dm.QTempSeleksi.RecNo > 3 Then
 Begin
  QRSysData1.Enabled := False;
  QRDBText3.Enabled := False;
  QRDBText4.Enabled := False;
 End
 Else
 Begin
  QRSysData1.Enabled := True;
  QRDBText3.Enabled := True;
  QRDBText4.Enabled := True;
 End;
end;

end.

DafJuri.pas
unit DafJuri;

interface

uses Windows, SysUtils, Messages, Classes, Graphics, Controls,
  StdCtrls, ExtCtrls, Forms, QuickRpt, QRCtrls, jpeg;

type
  TQrJuri = class(TQuickRep)
    TitleBand1: TQRBand;
    QRLabel1: TQRLabel;
    QRShape2: TQRShape;
    QRImage2: TQRImage;
    QRLabel5: TQRLabel;
    QRLabel6: TQRLabel;
    QRLabel7: TQRLabel;
    QRLabel8: TQRLabel;
    QRLabel9: TQRLabel;
    QRLabel10: TQRLabel;
    QRLabel11: TQRLabel;
    QRLabel12: TQRLabel;
    QRLabel13: TQRLabel;
    QRLabel14: TQRLabel;
    ColumnHeaderBand1: TQRBand;
    PageFooterBand1: TQRBand;
    QRSysData2: TQRSysData;
    QRBand1: TQRBand;
    QRDBText3: TQRDBText;
    QRDBText4: TQRDBText;
    QRDBText6: TQRDBText;
    QRDBText5: TQRDBText;
    QRLabel4: TQRLabel;
    QRLabel16: TQRLabel;
    QRLabel17: TQRLabel;
    QRLabel18: TQRLabel;
    QRImage1: TQRImage;
    QRLabel2: TQRLabel;
    QRLabel15: TQRLabel;
    QRLabel19: TQRLabel;
    QRLabel3: TQRLabel;
    QRLabel20: TQRLabel;
  private

  public

  end;

var
  QrJuri: TQrJuri;

implementation

uses Modul;

{$R *.DFM}

end.

DafKategori.pas

unit DafKategori;

interface

uses Windows, SysUtils, Messages, Classes, Graphics, Controls,
  StdCtrls, ExtCtrls, Forms, QuickRpt, QRCtrls, jpeg;

type
  TQrKategori = class(TQuickRep)
    TitleBand1: TQRBand;
    QRLabel1: TQRLabel;
    QRShape2: TQRShape;
    ColumnHeaderBand1: TQRBand;
    QRLabel3: TQRLabel;
    QRLabel2: TQRLabel;
    QRLabel4: TQRLabel;
    QRSubDetail1: TQRSubDetail;
    QRDBText2: TQRDBText;
    QRDBText3: TQRDBText;
    QRDBText4: TQRDBText;
    QRSubDetail2: TQRSubDetail;
    QRDBText1: TQRDBText;
    QRDBText5: TQRDBText;
    QRLabel6: TQRLabel;
    QRDBText6: TQRDBText;
    QRLabel7: TQRLabel;
    QRLabel8: TQRLabel;
    QRLabel9: TQRLabel;
    QRLabel10: TQRLabel;
    QRLabel11: TQRLabel;
    QRLabel12: TQRLabel;
    QRLabel13: TQRLabel;
    QRLabel14: TQRLabel;
    PageFooterBand1: TQRBand;
    QRSysData2: TQRSysData;
    QRLabel15: TQRLabel;
    QRLabel19: TQRLabel;
    QRImage2: TQRImage;
    QRLabel5: TQRLabel;
    QRLabel16: TQRLabel;
    QRLabel17: TQRLabel;
    QRLabel20: TQRLabel;
    QRImage1: TQRImage;
    procedure QRSubDetail1BeforePrint(Sender: TQRCustomBand;
      var PrintBand: Boolean);
    procedure QRSubDetail2AfterPrint(Sender: TQRCustomBand;
      BandPrinted: Boolean);
  private

  public

  end;

var
  QrKategori: TQrKategori;

implementation

uses Modul, DBTables;

{$R *.DFM}

procedure TQrKategori.QRSubDetail1BeforePrint(Sender: TQRCustomBand;
  var PrintBand: Boolean);
begin
 With Dm.QKlasifikasi do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select * From Klasifikasi Where Kd_Kategori ="'+Dm.QKategoriKd_Kategori.Value+'" ');
  Prepare;
  Open;
 End;

 QRDBText1.Enabled := True;
 QRDBText6.Enabled := True;
 DM.QKlasifikasi.first;
 PrintBand := DM.QKlasifikasi.EOF;
end;

procedure TQrKategori.QRSubDetail2AfterPrint(Sender: TQRCustomBand;
  BandPrinted: Boolean);
begin
 QRDBText1.Enabled := False;
 QRDBText6.Enabled := False;
end;
end.
DafNilaiJuaraKategori.pas

unit DafNilaiJuaraKategori;

interface

uses Windows, SysUtils, Messages, Classes, Graphics, Controls,
  StdCtrls, ExtCtrls, Forms, QuickRpt, QRCtrls, jpeg;

type
  TQrNilaiJuaraKategori = class(TQuickRep)
    TitleBand1: TQRBand;
    QRLabel1: TQRLabel;
    QRShape2: TQRShape;
    QRLabel6: TQRLabel;
    QRLabel7: TQRLabel;
    QRLabel8: TQRLabel;
    QRLabel9: TQRLabel;
    QRLabel10: TQRLabel;
    QRLabel11: TQRLabel;
    QRLabel12: TQRLabel;
    QRLabel13: TQRLabel;
    QRLabel14: TQRLabel;
    ColumnHeaderBand1: TQRBand;
    QRLabel3: TQRLabel;
    QRLabel15: TQRLabel;
    QRLabel2: TQRLabel;
    QRLabel4: TQRLabel;
    QRLabel16: TQRLabel;
    QRLabel17: TQRLabel;
    QRBand1: TQRBand;
    QRDBText2: TQRDBText;
    QRDBText1: TQRDBText;
    QRDBText3: TQRDBText;
    QRSysData1: TQRSysData;
    QRDBText4: TQRDBText;
    QRDBText5: TQRDBText;
    QRLabel18: TQRLabel;
    QRLabel5: TQRLabel;
    QRLabel19: TQRLabel;
    QRLabel20: TQRLabel;
    QRLabel21: TQRLabel;
    QRImage1: TQRImage;
    QRImage2: TQRImage;
    PageFooterBand1: TQRBand;
    QRSysData2: TQRSysData;
    QRLabel22: TQRLabel;
    QRLabel23: TQRLabel;
    QRDBText6: TQRDBText;
    QRLabel24: TQRLabel;
  private

  public

  end;

var
  QrNilaiJuaraKategori: TQrNilaiJuaraKategori;

implementation

uses Modul;

{$R *.DFM}

end.

DafNilaiJuaraKomunitas.pas

unit DafNilaiJuaraKomunitas;

interface

uses Windows, SysUtils, Messages, Classes, Graphics, Controls,
  StdCtrls, ExtCtrls, Forms, QuickRpt, QRCtrls, jpeg;

type
  TQrNilaiJuaraKomunitas = class(TQuickRep)
    TitleBand1: TQRBand;
    QRLabel1: TQRLabel;
    QRShape2: TQRShape;
    QRLabel6: TQRLabel;
    QRLabel7: TQRLabel;
    QRLabel8: TQRLabel;
    QRLabel9: TQRLabel;
    QRLabel10: TQRLabel;
    QRLabel11: TQRLabel;
    QRLabel12: TQRLabel;
    QRLabel13: TQRLabel;
    QRLabel14: TQRLabel;
    ColumnHeaderBand1: TQRBand;
    QRLabel3: TQRLabel;
    QRLabel15: TQRLabel;
    QRLabel2: TQRLabel;
    QRLabel4: TQRLabel;
    QRBand1: TQRBand;
    QRDBText2: TQRDBText;
    QRDBText1: TQRDBText;
    QRDBText3: TQRDBText;
    QRSysData1: TQRSysData;
    QRLabel16: TQRLabel;
    QRLabel17: TQRLabel;
    QRLabel18: TQRLabel;
    QRDBText4: TQRDBText;
    QRDBText5: TQRDBText;
    QRDBText6: TQRDBText;
    QRLabel5: TQRLabel;
    QRLabel19: TQRLabel;
    QRLabel20: TQRLabel;
    QRLabel21: TQRLabel;
    QRImage1: TQRImage;
    QRImage2: TQRImage;
    PageFooterBand1: TQRBand;
    QRSysData2: TQRSysData;
    QRLabel22: TQRLabel;
    QRLabel23: TQRLabel;
    QRLabel24: TQRLabel;
    QRSysData3: TQRSysData;
    procedure QRBand1BeforePrint(Sender: TQRCustomBand;
      var PrintBand: Boolean);
  private

  public
  end;

var
  QrNilaiJuaraKomunitas: TQrNilaiJuaraKomunitas;
  Nilai : Real;

implementation

uses Modul, DB;

{$R *.DFM}

procedure TQrNilaiJuaraKomunitas.QRBand1BeforePrint(Sender: TQRCustomBand;
  var PrintBand: Boolean);
begin
// Nilai := Dm.QTempSeleksiNilai.Value;
end;

end.

DafNilaiKeseluruhan.pas

unit DafNilaiKeseluruhan;

interface

uses Windows, SysUtils, Messages, Classes, Graphics, Controls,
  StdCtrls, ExtCtrls, Forms, QuickRpt, QRCtrls, jpeg;

type
  TQrNilaiKeseluruhan = class(TQuickRep)
    TitleBand1: TQRBand;
    QRLabel1: TQRLabel;
    QRShape2: TQRShape;
    QRLabel6: TQRLabel;
    QRLabel7: TQRLabel;
    QRLabel8: TQRLabel;
    QRLabel9: TQRLabel;
    QRLabel10: TQRLabel;
    QRLabel11: TQRLabel;
    QRLabel12: TQRLabel;
    QRLabel13: TQRLabel;
    QRLabel14: TQRLabel;
    ColumnHeaderBand1: TQRBand;
    QRLabel3: TQRLabel;
    QRLabel2: TQRLabel;
    QRLabel4: TQRLabel;
    QRLabel15: TQRLabel;
    QRSubDetail1: TQRSubDetail;
    QRDBText2: TQRDBText;
    QRDBText3: TQRDBText;
    QRDBText1: TQRDBText;
    QRLabel17: TQRLabel;
    QRSubDetail2: TQRSubDetail;
    QRDBText5: TQRDBText;
    QRDBText6: TQRDBText;
    QRDBText7: TQRDBText;
    QRLabel18: TQRLabel;
    QRLabel5: TQRLabel;
    QRLabel16: TQRLabel;
    QRLabel19: TQRLabel;
    QRLabel20: TQRLabel;
    QRImage1: TQRImage;
    QRImage2: TQRImage;
    PageFooterBand1: TQRBand;
    QRSysData2: TQRSysData;
    QRLabel21: TQRLabel;
    QRLabel22: TQRLabel;
    procedure QRSubDetail1BeforePrint(Sender: TQRCustomBand;
      var PrintBand: Boolean);
    procedure QRSubDetail2AfterPrint(Sender: TQRCustomBand;
      BandPrinted: Boolean);
  private

  public

  end;

var
  QrNilaiKeseluruhan: TQrNilaiKeseluruhan;

implementation

uses Modul, Utama;

{$R *.DFM}

procedure TQrNilaiKeseluruhan.QRSubDetail1BeforePrint(
  Sender: TQRCustomBand; var PrintBand: Boolean);
Var Total : Real;
    I : Byte;
begin
 With Dm.QNilai3 do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select b.nm_juri, a.total, a.kd_audisi ');
  Sql.add('From nilai a, juri b Where a.kd_juri=b.kd_juri ');
  Sql.add('and a.kd_audisi="'+FUtama.KdAudisi+'" and kd_peserta = "'+Dm.QPesertaKd_Peserta.Value+'" ');
  Prepare;
  Open;
 End;

 Total := 0;
 Dm.QNilai3.First;
 For I := 1 To Dm.QNilai3.RecordCount Do
 Begin
  Total := Total + Dm.QNilai3total.Value;
  Dm.QNilai3.Next;
 End;

 QRLabel17.Caption := FloatToStr(Total);
 QRLabel18.Caption := FloatToStr(Total);

 QRDBText5.Enabled := True;
 QRLabel18.Enabled := True;

 QRDBText5.Enabled := True;
 DM.QNilai3.first;
 PrintBand := DM.QNilai3.EOF;
end;

procedure TQrNilaiKeseluruhan.QRSubDetail2AfterPrint(Sender: TQRCustomBand;
  BandPrinted: Boolean);
begin
 QRDBText5.Enabled := False;
 QRLabel18.Enabled := False;
end;

end.

DafNilaiPerKategoriPerJuri.pas

unit DafNilaiPerKategoriPerJuri;

interface

uses Windows, SysUtils, Messages, Classes, Graphics, Controls,
  StdCtrls, ExtCtrls, Forms, QuickRpt, QRCtrls, jpeg;

type
  TQrNilaiKategoriJuri = class(TQuickRep)
    TitleBand1: TQRBand;
    QRLabel1: TQRLabel;
    QRShape2: TQRShape;
    QRLabel6: TQRLabel;
    QRLabel7: TQRLabel;
    QRLabel8: TQRLabel;
    QRLabel9: TQRLabel;
    QRLabel10: TQRLabel;
    QRLabel11: TQRLabel;
    QRLabel12: TQRLabel;
    QRLabel13: TQRLabel;
    QRLabel14: TQRLabel;
    ColumnHeaderBand1: TQRBand;
    QRLabel3: TQRLabel;
    QRLabel2: TQRLabel;
    QRLabel4: TQRLabel;
    QRSubDetail1: TQRSubDetail;
    QRDBText2: TQRDBText;
    QRDBText3: TQRDBText;
    QRSubDetail2: TQRSubDetail;
    QRLabel15: TQRLabel;
    QRDBText1: TQRDBText;
    QRDBText5: TQRDBText;
    QRDBText6: TQRDBText;
    QRDBText7: TQRDBText;
    QRLabel16: TQRLabel;
    QRLabel17: TQRLabel;
    QRLabel18: TQRLabel;
    QRLabel5: TQRLabel;
    QRLabel19: TQRLabel;
    QRLabel20: TQRLabel;
    QRLabel21: TQRLabel;
    QRImage1: TQRImage;
    QRImage2: TQRImage;
    PageFooterBand1: TQRBand;
    QRSysData2: TQRSysData;
    QRLabel22: TQRLabel;
    QRLabel23: TQRLabel;
    procedure QRSubDetail1BeforePrint(Sender: TQRCustomBand;
      var PrintBand: Boolean);
    procedure QRSubDetail2AfterPrint(Sender: TQRCustomBand;
      BandPrinted: Boolean);
  private

  public

  end;

var
  QrNilaiKategoriJuri: TQrNilaiKategoriJuri;

implementation

uses Modul, Utama;

{$R *.DFM}

procedure TQrNilaiKategoriJuri.QRSubDetail1BeforePrint(
  Sender: TQRCustomBand; var PrintBand: Boolean);
Var Total : Real;
    I : Byte;
begin
 With Dm.QNilai2 do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select c.kd_peserta, c.kd_juri, b.kd_kategori, d.nm_kategori,  avg(a.nilai), d.bobot, c.kd_audisi ');
  Sql.add('From dtnilai a, klasifikasi b, nilai c, kategori d ');
  Sql.add('Where a.kd_klasifikasi=b.kd_klasifikasi and a.kd_nilai=c.kd_nilai and b.kd_kategori=d.kd_kategori ');
  Sql.add('and c.kd_juri = "'+Dm.QJuriKd_Juri.Value+'" and c.kd_audisi="'+FUtama.KdAudisi+'" and kd_peserta = "'+Dm.QPesertaKd_Peserta.Value+'" ');
  Sql.add('group by c.kd_peserta, c.kd_juri, b.kd_kategori, d.nm_kategori, c.kd_audisi, d.bobot ');
  Prepare;
  Open;
 End;

 Total := 0;
 Dm.QNilai2.First;
 For I := 1 To Dm.QNilai2.RecordCount Do
 Begin
  Total := Total + Dm.QNilai2NilaiBobot.Value;
  Dm.QNilai2.Next;
 End;

 QRLabel17.Caption := FloatToStr(Total);
 QRLabel18.Caption := FloatToStr(Total);

 QRDBText5.Enabled := True;
 QRLabel18.Enabled := True;

 QRDBText5.Enabled := True;
 DM.QNilai2.first;
 PrintBand := DM.QNilai2.EOF;
end;

procedure TQrNilaiKategoriJuri.QRSubDetail2AfterPrint(
  Sender: TQRCustomBand; BandPrinted: Boolean);
begin
 QRDBText5.Enabled := False;
 QRLabel18.Enabled := False;
end;
end.
DafNilaiPerKlasifikasiPerJuri.pas

unit DafNilaiPerKlasifikasiPerJuri;

interface

uses Windows, SysUtils, Messages, Classes, Graphics, Controls,
  StdCtrls, ExtCtrls, Forms, QuickRpt, QRCtrls, jpeg;

type
  TQrNilaiKlasifikasiJuri = class(TQuickRep)
    TitleBand1: TQRBand;
    QRLabel1: TQRLabel;
    QRShape2: TQRShape;
    QRLabel6: TQRLabel;
    QRLabel7: TQRLabel;
    QRLabel8: TQRLabel;
    QRLabel9: TQRLabel;
    QRLabel10: TQRLabel;
    QRLabel11: TQRLabel;
    QRLabel12: TQRLabel;
    QRLabel13: TQRLabel;
    QRLabel14: TQRLabel;
    QRLabel16: TQRLabel;
    ColumnHeaderBand1: TQRBand;
    QRLabel3: TQRLabel;
    QRLabel2: TQRLabel;
    QRLabel4: TQRLabel;
    QRLabel15: TQRLabel;
    QRSubDetail1: TQRSubDetail;
    QRDBText2: TQRDBText;
    QRDBText3: TQRDBText;
    QRDBText1: TQRDBText;
    QRSubDetail2: TQRSubDetail;
    QRDBText5: TQRDBText;
    QRDBText6: TQRDBText;
    QRDBText7: TQRDBText;
    QRLabel17: TQRLabel;
    QRLabel18: TQRLabel;
    QRLabel5: TQRLabel;
    QRLabel19: TQRLabel;
    QRLabel20: TQRLabel;
    QRLabel21: TQRLabel;
    QRImage1: TQRImage;
    QRImage2: TQRImage;
    PageFooterBand1: TQRBand;
    QRSysData2: TQRSysData;
    QRLabel22: TQRLabel;
    QRLabel23: TQRLabel;
    QRLabel24: TQRLabel;
    QRDBText4: TQRDBText;
    QRLabel25: TQRLabel;
    QRDBText8: TQRDBText;
    QRDBText9: TQRDBText;
    QRDBText10: TQRDBText;
    procedure QRSubDetail1BeforePrint(Sender: TQRCustomBand;
      var PrintBand: Boolean);
    procedure QRSubDetail2AfterPrint(Sender: TQRCustomBand;
      BandPrinted: Boolean);
    procedure QRSubDetail1AfterPrint(Sender: TQRCustomBand;
      BandPrinted: Boolean);
  private

  public

  end;

var
  QrNilaiKlasifikasiJuri: TQrNilaiKlasifikasiJuri;

implementation

uses Modul, Utama;

{$R *.DFM}

procedure TQrNilaiKlasifikasiJuri.QRSubDetail1BeforePrint(
  Sender: TQRCustomBand; var PrintBand: Boolean);
Var Total : Real;
    I : Byte;
begin
 With Dm.QNilai1 do
 Begin
  Close;
  Sql.Clear;
  Sql.add('Select a.kd_nilai, c.kd_juri, a.kd_klasifikasi, b. nm_klasifikasi, b.kd_kategori, d.nm_kategori, d.bobot, a.nilai, c.kd_audisi, c.kd_peserta ');
  Sql.add('From dtnilai a, klasifikasi b, nilai c, kategori d ');
  Sql.add('Where a.kd_klasifikasi=b.kd_klasifikasi and a.kd_nilai=c.kd_nilai and b.kd_kategori=d.kd_kategori ');
  Sql.add('and c.kd_juri = "'+Dm.QJuriKd_Juri.Value+'" and c.kd_audisi="'+FUtama.KdAudisi+'" and kd_peserta = "'+Dm.QPesertaKd_Peserta.Value+'" ');
  Sql.add('Order By a.kd_klasifikasi  ');
  Prepare;
  Open;
 End;
 Total := 0;
 Dm.QNilai1.First;
 For I := 1 To Dm.QNilai1.RecordCount Do
 Begin
  Total := Total + Dm.QNilai1NilaiBobot.Value;
  Dm.QNilai1.Next;
 End;
 QRLabel17.Caption := FloatToStr(Total);
 QRLabel18.Caption := FloatToStr(Total);

 QRDBText5.Enabled := True;
 QRLabel18.Enabled := True;
 DM.QNilai1.first;
 PrintBand := DM.QNilai1.EOF;
end;

procedure TQrNilaiKlasifikasiJuri.QRSubDetail2AfterPrint(
  Sender: TQRCustomBand; BandPrinted: Boolean);
begin
 If FUtama.Kategori = '0' Then
 Begin
  If Copy(Dm.QNilai1kd_klasifikasi.Value, 10,1) = '1' Then
  Begin
   QRDBText9.Enabled  := True;
   QRDBText10.Enabled := True;
  End
  Else
  Begin
   QRDBText9.Enabled  := False;
   QRDBText10.Enabled := False;
  End;
 End
 Else
 Begin
  If Copy(Dm.QNilai1kd_klasifikasi.Value, 10,1) = '1' Then
  Begin
   QRDBText9.Enabled  := False;
   QRDBText10.Enabled := False;
  End
  Else
  Begin
   QRDBText9.Enabled  := True;
   QRDBText10.Enabled := True;
  End;
 End;
 QRDBText5.Enabled := False;
 QRLabel18.Enabled := False;
end;

procedure TQrNilaiKlasifikasiJuri.QRSubDetail1AfterPrint(
  Sender: TQRCustomBand; BandPrinted: Boolean);
begin
 If Copy(Dm.QNilai1kd_klasifikasi.Value, 10,1) = '1' Then
 Begin
  QRDBText9.Enabled  := True;
  QRDBText10.Enabled := True;
 End
 Else
 Begin
  QRDBText9.Enabled  := False;
  QRDBText10.Enabled := False;
 End;
end;

end.

DafNilaiTotal.pas

unit DafNilaiTotal;

interface

uses Windows, SysUtils, Messages, Classes, Graphics, Controls,
  StdCtrls, ExtCtrls, Forms, QuickRpt, QRCtrls, jpeg;

type
  TQrNilaiTotal = class(TQuickRep)
    TitleBand1: TQRBand;
    QRLabel1: TQRLabel;
    QRShape2: TQRShape;
    QRLabel6: TQRLabel;
    QRLabel7: TQRLabel;
    QRLabel8: TQRLabel;
    QRLabel9: TQRLabel;
    QRLabel10: TQRLabel;
    QRLabel11: TQRLabel;
    QRLabel12: TQRLabel;
    QRLabel13: TQRLabel;
    QRLabel14: TQRLabel;
    ColumnHeaderBand1: TQRBand;
    QRLabel3: TQRLabel;
    QRLabel15: TQRLabel;
    QRBand1: TQRBand;
    QRDBText2: TQRDBText;
    QRDBText1: TQRDBText;
    QRLabel2: TQRLabel;
    QRDBText3: TQRDBText;
    QRLabel4: TQRLabel;
    QRSysData1: TQRSysData;
    QRLabel5: TQRLabel;
    QRLabel16: TQRLabel;
    QRLabel17: TQRLabel;
    QRLabel20: TQRLabel;
    QRImage1: TQRImage;
    QRImage2: TQRImage;
    PageFooterBand1: TQRBand;
    QRSysData2: TQRSysData;
    QRLabel18: TQRLabel;
    QRLabel19: TQRLabel;
    QRLabel21: TQRLabel;
    QRDBText4: TQRDBText;
    QRLabel22: TQRLabel;
    QRLabel23: TQRLabel;
    procedure QRBand1BeforePrint(Sender: TQRCustomBand;
      var PrintBand: Boolean);
  private

  public
   NilaiBatas : Real;
   JumJuri : Byte;
  end;

var
  QrNilaiTotal: TQrNilaiTotal;

implementation

uses Modul, Utama, DB;

{$R *.DFM}

procedure TQrNilaiTotal.QRBand1BeforePrint(Sender: TQRCustomBand;
  var PrintBand: Boolean);
begin
 IF JumJuri = 1 Then
 Begin
  If Dm.QTempSeleksiNilai.Value >= 50 Then
   QrNilaiTotal.QRLabel23.Caption := 'L'
  Else
   QrNilaiTotal.QRLabel23.Caption := 'T';
 End
 Else
 IF JumJuri = 2 Then
 Begin
  If Dm.QTempSeleksiNilai.Value >= 100 Then
   QrNilaiTotal.QRLabel23.Caption := 'L'
  Else
   QrNilaiTotal.QRLabel23.Caption := 'T';
 End
 Else
 IF JumJuri = 3 Then
 Begin
  If Dm.QTempSeleksiNilai.Value >= 150 Then
   QrNilaiTotal.QRLabel23.Caption := 'L'
  Else
   QrNilaiTotal.QRLabel23.Caption := 'T';
 End
 Else
 IF JumJuri = 4 Then
 Begin
  If Dm.QTempSeleksiNilai.Value >= 200 Then
   QrNilaiTotal.QRLabel23.Caption := 'L'
  Else
   QrNilaiTotal.QRLabel23.Caption := 'T';
 End
 Else
 IF JumJuri = 5 Then
 Begin
  If Dm.QTempSeleksiNilai.Value >= 250 Then
   QrNilaiTotal.QRLabel23.Caption := 'L'
  Else
   QrNilaiTotal.QRLabel23.Caption := 'T';
 End;
end;

end.

DafPeserta.pas

unit DafPeserta;

interface

uses Windows, SysUtils, Messages, Classes, Graphics, Controls,
  StdCtrls, ExtCtrls, Forms, QuickRpt, QRCtrls, jpeg;

type
  TQrPeserta = class(TQuickRep)
    TitleBand1: TQRBand;
    QRLabel1: TQRLabel;
    QRShape2: TQRShape;
    QRLabel6: TQRLabel;
    QRLabel7: TQRLabel;
    QRLabel8: TQRLabel;
    QRLabel9: TQRLabel;
    QRLabel10: TQRLabel;
    QRLabel11: TQRLabel;
    QRLabel12: TQRLabel;
    QRLabel13: TQRLabel;
    QRLabel14: TQRLabel;
    ColumnHeaderBand1: TQRBand;
    QRLabel3: TQRLabel;
    QRLabel2: TQRLabel;
    QRLabel4: TQRLabel;
    QRLabel16: TQRLabel;
    QRLabel17: TQRLabel;
    QRLabel18: TQRLabel;
    QRBand1: TQRBand;
    QRDBText1: TQRDBText;
    QRDBText2: TQRDBText;
    QRDBText3: TQRDBText;
    QRDBText4: TQRDBText;
    QRDBText6: TQRDBText;
    QRDBText5: TQRDBText;
    QRLabel5: TQRLabel;
    QRLabel15: TQRLabel;
    QRLabel19: TQRLabel;
    QRLabel20: TQRLabel;
    QRImage1: TQRImage;
    QRImage2: TQRImage;
    PageFooterBand1: TQRBand;
    QRSysData2: TQRSysData;
    QRLabel21: TQRLabel;
    QRLabel22: TQRLabel;
  private

  public

  end;

var
  QrPeserta: TQrPeserta;

implementation

uses Modul;

{$R *.DFM}

end.