INSERT INTO tb_komponen_gaji (kode_komponen,nama_komponen,jenis,tipe_nilai,cara_hitung,nilai_default,formula_expression,urutan,tipe_periode,is_wajib,is_active)
SELECT 'THR','Tunjangan Hari Raya (THR)','TUNJANGAN','NOMINAL','FORMULA',0,'ROUND((GAPOK + TJ_POSISI) / 12 * MIN(MASA_KERJA_BULAN, 12), 0)',50,'THR',0,1
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM tb_komponen_gaji WHERE kode_komponen='THR');

INSERT INTO tb_komponen_gaji (kode_komponen,nama_komponen,jenis,tipe_nilai,cara_hitung,nilai_default,formula_expression,urutan,tipe_periode,is_wajib,is_active)
SELECT 'BPJS_KES_KRY','BPJS Kesehatan Karyawan (1%)','POTONGAN','NOMINAL','FORMULA',0,'ROUND(GAPOK * 0.01, 0)',60,'REGULER',0,1
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM tb_komponen_gaji WHERE kode_komponen='BPJS_KES_KRY');

INSERT INTO tb_komponen_gaji (kode_komponen,nama_komponen,jenis,tipe_nilai,cara_hitung,nilai_default,formula_expression,urutan,tipe_periode,is_wajib,is_active)
SELECT 'BPJS_KES_PRS','BPJS Kesehatan Perusahaan (4%)','TUNJANGAN','NOMINAL','FORMULA',0,'ROUND(GAPOK * 0.04, 0)',61,'REGULER',0,1
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM tb_komponen_gaji WHERE kode_komponen='BPJS_KES_PRS');

INSERT INTO tb_komponen_gaji (kode_komponen,nama_komponen,jenis,tipe_nilai,cara_hitung,nilai_default,formula_expression,urutan,tipe_periode,is_wajib,is_active)
SELECT 'BPJS_JHT_KRY','BPJS JHT Karyawan (2%)','POTONGAN','NOMINAL','FORMULA',0,'ROUND(GAPOK * 0.02, 0)',62,'REGULER',0,1
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM tb_komponen_gaji WHERE kode_komponen='BPJS_JHT_KRY');

INSERT INTO tb_komponen_gaji (kode_komponen,nama_komponen,jenis,tipe_nilai,cara_hitung,nilai_default,formula_expression,urutan,tipe_periode,is_wajib,is_active)
SELECT 'BPJS_JHT_PRS','BPJS JHT Perusahaan (3.7%)','TUNJANGAN','NOMINAL','FORMULA',0,'ROUND(GAPOK * 0.037, 0)',63,'REGULER',0,1
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM tb_komponen_gaji WHERE kode_komponen='BPJS_JHT_PRS');

INSERT INTO tb_komponen_gaji (kode_komponen,nama_komponen,jenis,tipe_nilai,cara_hitung,nilai_default,formula_expression,urutan,tipe_periode,is_wajib,is_active)
SELECT 'BPJS_JP_KRY','BPJS Pensiun Karyawan (1%)','POTONGAN','NOMINAL','FORMULA',0,'ROUND(GAPOK * 0.01, 0)',64,'REGULER',0,1
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM tb_komponen_gaji WHERE kode_komponen='BPJS_JP_KRY');

INSERT INTO tb_komponen_gaji (kode_komponen,nama_komponen,jenis,tipe_nilai,cara_hitung,nilai_default,formula_expression,urutan,tipe_periode,is_wajib,is_active)
SELECT 'BPJS_JP_PRS','BPJS Pensiun Perusahaan (2%)','TUNJANGAN','NOMINAL','FORMULA',0,'ROUND(GAPOK * 0.02, 0)',65,'REGULER',0,1
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM tb_komponen_gaji WHERE kode_komponen='BPJS_JP_PRS');

INSERT INTO tb_komponen_gaji (kode_komponen,nama_komponen,jenis,tipe_nilai,cara_hitung,nilai_default,formula_expression,urutan,tipe_periode,is_wajib,is_active)
SELECT 'PPH21_EST','PPh 21 Estimasi (5% Bruto/12)','POTONGAN','NOMINAL','FORMULA',0,'ROUND(BRUTO_SEMENTARA * 0.05 / 12, 0)',70,'REGULER',0,1
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM tb_komponen_gaji WHERE kode_komponen='PPH21_EST');
