/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package sikd.ikonsol.ctrl;

import java.io.Serializable;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.application.FacesMessage;
import javax.faces.view.ViewScoped;
import javax.inject.Named;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.primefaces.PrimeFaces;
import sikd.ikonsol.ejb.session.AkunEliminasiEjbHome;
import sikd.ikonsol.ejb.session.HeaderResiprokalEjbHome;
import sikd.ikonsol.ejb.session.JenisBasEjbHome;
import sikd.ikonsol.ejb.session.JenisLaporanEjbHome;
import sikd.ikonsol.ejb.session.JenisTransferEjbHome;
import sikd.ikonsol.ejb.session.KategoriPemdaEjbHome;
import sikd.ikonsol.ejb.session.PeriodeEjbHome;
import sikd.ikonsol.ejb.session.RefPemdaEjbHome;
import sikd.ikonsol.model.AkunEliminasi;
import sikd.ikonsol.model.HeaderResiprokal;
import sikd.ikonsol.model.JenisBas;
import sikd.ikonsol.model.JenisLaporan;
import sikd.ikonsol.model.JenisTransfer;
import sikd.ikonsol.model.KategoriPemda;
import sikd.ikonsol.model.Periode;
import sikd.ikonsol.model.ReferensiPemda;
import sikd.ikonsol.model.ReferensiWilayah;

/**
 *
 * @author Imam Bhoim
 */
@ViewScoped
@Named(value = "akunEliminasiBeanCtrl")
public class AkunEliminasiBeanCtrl extends AbstractReportBean implements Serializable {

    private String COMPILE_FILE_NAME = "";//"spd_depan";
    AkunEliminasi akel;
    AkunEliminasi obj;

    private List<AkunEliminasi> list, listkode;
    private List<ReferensiPemda> listProv;
    private List<ReferensiWilayah> listDataWilayah;

    private List<JenisBas> listjbas;
    private List<JenisLaporan> listjlaporan, listlak;
    private List<Periode> listperiode;

    private List<AkunEliminasi> listNasional, listNasionalLak;
    private List<AkunEliminasi> listWilayah, listWilayahLak;
    private List<AkunEliminasi> listProvinsi, listProvinsiLak;

    private List<KategoriPemda> listkatpemda;

    private List<JenisTransfer> listjtransfer;

    private List<HeaderResiprokal> listResiprokal;

    private int idbas = 0;
    private int tahun;
    private int idjnslaporan;
    private String kdPeriode = null;
    private String kdPemda = null;
    private String kdWilayah = null;

    private String kdp = null;
    private String namaprov = null;
    private String namaperiode = null;

    HeaderResiprokal hd;
    JenisBas jb;
    ReferensiPemda rp;
    JenisLaporan jl;
    Periode p;

    @EJB
    AkunEliminasiEjbHome akeliminasiEjbHome;

    @EJB
    JenisBasEjbHome jenisBasEjbHome;

    @EJB
    JenisLaporanEjbHome jenisLaporanEjbHome;

    @EJB
    PeriodeEjbHome periodeBasEjbHome;

    @EJB
    RefPemdaEjbHome pemdaEjbHome;

    @EJB
    KategoriPemdaEjbHome katPemdaEjbHome;

    @EJB
    HeaderResiprokalEjbHome headerResiprokalEjbHome;

    @EJB
    JenisTransferEjbHome jenisTransferEjbHome;

    @PostConstruct
    public void init() {

        akel = new AkunEliminasi();

        list = akeliminasiEjbHome.findAllByTahunBasJenisLap(tahun, idbas, idjnslaporan, kdPeriode);

        listjbas = jenisBasEjbHome.findAllAktif();

        listjlaporan = jenisLaporanEjbHome.findAllLra();

        listlak = jenisLaporanEjbHome.findAllLak();

        listperiode = periodeBasEjbHome.findAllAktif();

        listjtransfer = jenisTransferEjbHome.findAll();

        try {
            listNasional = akeliminasiEjbHome.findByListNasional(kdPeriode, idbas, idjnslaporan, tahun);

        } catch (Exception e) {
            // System.out.println(e);
        }

        try {
            listProvinsi = akeliminasiEjbHome.findByListProv(kdPeriode, idbas, idjnslaporan, tahun, kdPemda);

        } catch (Exception e) {
            // System.out.print(e);
        }

        try {
            listWilayah = akeliminasiEjbHome.findByListWilayah(kdPeriode, idbas, idjnslaporan, tahun, kdWilayah);

        } catch (Exception e) {
            // System.out.print(e);
        }

        try {
            listProvinsiLak = akeliminasiEjbHome.findAllByListProvLak(kdPeriode, idjnslaporan, tahun, kdPemda);

        } catch (Exception e) {
            // System.out.print(e);
        }

        try {
            listWilayahLak = akeliminasiEjbHome.findByListWilayahLak(kdPeriode, idjnslaporan, tahun, kdWilayah);

        } catch (Exception e) {
            // System.out.print(e);
        }

        try {
            listNasionalLak = akeliminasiEjbHome.findByListNasionalLak(kdPeriode, idjnslaporan, tahun);

        } catch (Exception e) {
            // System.out.print(e);
        }

        listProv = pemdaEjbHome.findAllProvinsi("__.00");
        listDataWilayah = pemdaEjbHome.findAllWilayah();

        listkatpemda = katPemdaEjbHome.findAll();

    }

    public void add(int idheader) {

        //  jbas = jbasEjbHome.createNew();
        akel = akeliminasiEjbHome.createNew();

        listResiprokal = headerResiprokalEjbHome.findAkunResiprokal(idjnslaporan);

        akel.setIdheaderkons(idheader);
    }

    public String saveProses() {

        // simpan
        akeliminasiEjbHome.saveProses(akel);

        list = akeliminasiEjbHome.selectCompare();

        //this.list = service.findAll();
        return "index?faces-redirect=true";
    }

    public void reload() {

        list = akeliminasiEjbHome.findAllByTahunBasJenisLap(tahun, idbas, idjnslaporan, kdPeriode);

    }

    public void reloadLaporanProv() {

        try {
            listProvinsi = akeliminasiEjbHome.findByListProv(kdPeriode, idbas, idjnslaporan, tahun, kdPemda);

        } catch (Exception r) {
            //r.printStackTrace();
        }

    }

    public void reloadLaporanWilayah() {

        try {
            listWilayah = akeliminasiEjbHome.findByListWilayah(kdPeriode, idbas, idjnslaporan, tahun, kdWilayah);
        } catch (Exception r) {
            // r.printStackTrace();
        }

    }

    public void reloadLaporan() {

        try {
            listNasional = akeliminasiEjbHome.findByListNasional(kdPeriode, idbas, idjnslaporan, tahun);
        } catch (Exception c) {
            // System.out.println("lnlistNasional.siec()" + listNasional.size());
        }

//        this.getSumNilai();
        //       this.getSumEliminasi();
    }

    public void reloadLaporanProvLak() {

        try {
            listProvinsiLak = akeliminasiEjbHome.findAllByListProvLak(kdPeriode, idjnslaporan, tahun, kdPemda);
        } catch (Exception r) {
            //r.printStackTrace();
        }

    }

    public void reloadLaporanWilayahLak() {

        try {
            listWilayahLak = akeliminasiEjbHome.findByListWilayahLak(kdPeriode, idjnslaporan, tahun, kdWilayah);
        } catch (Exception r) {
            // r.printStackTrace();
        }

    }

    public void reloadLaporanLak() {

        try {
            listNasionalLak = akeliminasiEjbHome.findByListNasionalLak(kdPeriode, idjnslaporan, tahun);
        } catch (Exception c) {
            // System.out.println("lnlistNasional.siec()" + listNasional.size());
        }

//        this.getSumNilai();
        //       this.getSumEliminasi();
    }

    public String refNama1(int kode1, int bast) {
        String name = null;
        try {
            name = akeliminasiEjbHome.selectRefAkun1(String.valueOf(kode1), 1).getNamaakun();
        } catch (Exception c) {
            //c.printStackTrace();
        }
        return name;
    }

    public String refNama2(int kode1, int kode2, int bast) {
        String name = null;
        try {
            name = akeliminasiEjbHome.selectRefAkun2(String.valueOf(kode1), String.valueOf(kode2), bast).getNamaakun();
        } catch (Exception c) {
            //c.printStackTrace();
        }
        return name;
    }

    public String refNama3(int kode1, int kode2, int kode3, int bast) {
        String name = null;
        try {
            name = akeliminasiEjbHome.selectRefAkun3(String.valueOf(kode1), String.valueOf(kode2), String.valueOf(kode3), bast).getNamaakun();
        } catch (Exception c) {
            //c.printStackTrace();
        }
        return name;
    }

    public String refNama4(int kode1, int kode2, int kode3, String kode4, int bast) {
        String name = null;
        try {
            name = akeliminasiEjbHome.selectRefAkun4(String.valueOf(kode1), String.valueOf(kode2), String.valueOf(kode3),
                    String.valueOf(kode4), bast).getNamaakun();
        } catch (Exception c) {
            //c.printStackTrace();
            name = "-";
        }
        return name;
    }

    public double refEliminasi(double nilai, int kode1, int kode2, int kode3, int bast, String kdperiode1, String kdprov1, int idjnslap1, int tahun1) {

        double name = 0;
        try {
            name = akeliminasiEjbHome.selectEliminasi(String.valueOf(kode1), String.valueOf(kode2), String.valueOf(kode3), bast, kdperiode1, kdprov1,
                    idjnslap1, tahun1).getNilaieliminasi();
            name = nilai - name;
        } catch (Exception ex) {
            //ex.printStackTrace();
            name = nilai;
        }

        return name;

    }

    public double refEliminasiWilayah(double nilai, int kode1, int kode2, int kode3, int bast, String kdperiode1, String kdwilayah1, int idjnslap1, int tahun1) {

        double name = 0;
        try {
            name = akeliminasiEjbHome.selectEliminasiWilayah(String.valueOf(kode1), String.valueOf(kode2), String.valueOf(kode3), bast, kdperiode1, kdwilayah1,
                    idjnslap1, tahun1).getNilaieliminasi();
            name = nilai - name;
        } catch (Exception ex) {
            //ex.printStackTrace();
            name = nilai;
        }

        return name;

    }

    public double refEliminasiNasional(double nilai, int kode1, int kode2, int kode3, int bast, String kdperiode1, int idjnslap1, int tahun1) {

        double name = 0;
        try {
            name = akeliminasiEjbHome.selectEliminasiNasional(String.valueOf(kode1), String.valueOf(kode2), String.valueOf(kode3), bast, kdperiode1,
                    idjnslap1, tahun1).getNilaieliminasi();
            name = nilai - name;
        } catch (Exception ex) {
            //ex.printStackTrace();
            name = nilai;
        }

        return name;

    }

    public double getSumNilai(int kdlvl1, int kdlvl2) {

        double total = 0;
        listNasional = akeliminasiEjbHome.findByListNasionalSummary(kdPeriode, idbas, idjnslaporan, tahun,
                kdlvl1, kdlvl2);

        for (AkunEliminasi obj : listNasional) {

            total += obj.getNilai();

        }

        return total;
        //return new DecimalFormat("#,##0.00").format(total);

    }

    public double getSumEliminasi(int kdlvl1, int kdlvl2) {

        double total = 0;
        listNasional = akeliminasiEjbHome.findByListNasionalSummaryEliminasi(kdPeriode, idbas, idjnslaporan, tahun, 
                kdlvl1, kdlvl2);

        for (AkunEliminasi obj : listNasional) {

            total += obj.getNilaieliminasi();

            // System.out.println("ttl " + total);
        }
        
        return total;        
//return new DecimalFormat("#,##0.00").format(total);
    }

    public double getSumNilaiProvinsi(int kdlvl1, int kdlvl2) {

        double total = 0;
        listProvinsi = akeliminasiEjbHome.findByListProvSummary(kdPeriode, idbas, idjnslaporan, tahun, kdPemda, kdlvl1, kdlvl2);

        for (AkunEliminasi obj : listProvinsi) {

            total += obj.getNilai();

        }

        return total;
        //return new DecimalFormat("#,##0.00").format(total);

    }

    public double getSumEliminasiProvinsi(int kdlvl1, int kdlvl2) {

        double total = 0;
        listProvinsi = akeliminasiEjbHome.findByListProvSummaryEliminasi(kdPeriode, idbas, idjnslaporan, tahun, kdPemda, kdlvl1, kdlvl2);

        for (AkunEliminasi obj : listProvinsi) {

            total += obj.getNilaieliminasi();

            //   System.out.println("ttl " + total);
        }
        return total;
        // return new DecimalFormat("#,##0.00").format(total);
    }

    public double getSumNilaiWilayah(int kdlvl1, int kdlvl2) {

        double total = 0;
        listWilayah = akeliminasiEjbHome.findByListWilayahSummary(kdPeriode, idbas, idjnslaporan, tahun, kdWilayah, kdlvl1, kdlvl2);

        for (AkunEliminasi obj : listWilayah) {

            total += obj.getNilai();

        }
        return total;

        //return new DecimalFormat("#,##0.00").format(total);

    }

    public double getSumEliminasiWilayah(int kdlvl1, int kdlvl2) {

        double total = 0;
        listWilayah = akeliminasiEjbHome.findByListWilayahSummaryEliminasi(kdPeriode, idbas, idjnslaporan, tahun, kdWilayah, kdlvl1, kdlvl2);

        for (AkunEliminasi obj : listWilayah) {

            total += obj.getNilaieliminasi();

            //    System.out.println("ttl " + total);
        }
        return total;
        //return new DecimalFormat("#,##0.00").format(total);
    }

    public void listkode(String kode, int id) {

        listkode = akeliminasiEjbHome.findByKodeProvinsi(kode, id, tahun, idbas, idjnslaporan, kdPeriode);

        jb = jenisBasEjbHome.findByID(idbas);
        hd = headerResiprokalEjbHome.findByID(id);

        //rp = pemdaEjbHome.findByKodeId(kode);
        jl = jenisLaporanEjbHome.findByID(idjnslaporan);

        kdp = kode;

        p = periodeBasEjbHome.findByKode(kdPeriode);

        rp = pemdaEjbHome.findByKodeProv(kdp);

        namaprov = rp.getNama_pemda();
        namaperiode = p.getNama();

    }

    public String save() {

        AkunEliminasi are = new AkunEliminasi();

        are = akeliminasiEjbHome.findByKodeAkunHeaderLengkap(tahun, kdp,
                akel.getKdrek1(), akel.getKdrek2(), akel.getKdrek3(),
                akel.getKdrek4(), akel.getKdrek5(), akel.getIdkatpemda(), idbas, idjnslaporan,
                akel.getIdheaderresipo(), akel.getIdjenistransfer(), akel.getIdheaderkons(), akel.getKdperiode());
        try {
            if (are == null) {
                String wilayah_id = akeliminasiEjbHome.selectKdWilayah(kdp).getKdwilayah();
                akel.setTahun(tahun);
                akel.setIdbas(idbas);
                akel.setKdpemda(kdp);
                akel.setKdwilayah(wilayah_id);
                akel.setIdjnslaporan(idjnslaporan);
                akel.setIdheaderresipo(hd.getId());
                akel.setKdperiode(kdPeriode);

                String kdrek4 = akel.getKdrek4().trim();
                String kdrek5 = akel.getKdrek5().trim();

                if (kdrek4.equalsIgnoreCase("1")) {
                    kdrek4 = "01";
                } else if (kdrek4.equalsIgnoreCase("2")) {
                    kdrek4 = "02";
                } else if (kdrek4.equalsIgnoreCase("3")) {
                    kdrek4 = "03";
                } else if (kdrek4.equalsIgnoreCase("4")) {
                    kdrek4 = "04";
                } else if (kdrek4.equalsIgnoreCase("5")) {
                    kdrek4 = "05";
                } else if (kdrek4.equalsIgnoreCase("6")) {
                    kdrek4 = "06";
                } else if (kdrek4.equalsIgnoreCase("7")) {
                    kdrek4 = "07";
                } else if (kdrek4.equalsIgnoreCase("8")) {
                    kdrek4 = "08";
                } else if (kdrek4.equalsIgnoreCase("9")) {
                    kdrek4 = "09";
                } else {
                    kdrek4 = kdrek4;
                }

                if (kdrek5.equalsIgnoreCase("1")) {
                    kdrek5 = "01";
                } else if (kdrek5.equalsIgnoreCase("2")) {
                    kdrek5 = "02";
                } else if (kdrek5.equalsIgnoreCase("3")) {
                    kdrek5 = "03";
                } else if (kdrek5.equalsIgnoreCase("4")) {
                    kdrek5 = "04";
                } else if (kdrek5.equalsIgnoreCase("5")) {
                    kdrek5 = "05";
                } else if (kdrek5.equalsIgnoreCase("6")) {
                    kdrek5 = "06";
                } else if (kdrek5.equalsIgnoreCase("7")) {
                    kdrek5 = "07";
                } else if (kdrek5.equalsIgnoreCase("8")) {
                    kdrek5 = "08";
                } else if (kdrek5.equalsIgnoreCase("9")) {
                    kdrek5 = "09";
                } else {
                    kdrek5 = kdrek5;
                }

                akel.setKdrek4(kdrek4);
                akel.setKdrek5(kdrek5);
                akel.setFlag("8");
                akel.setFlagProses("1");

                akeliminasiEjbHome.save(akel);
                System.out.println("SIMPAN 3");

                PrimeFaces.current().executeScript("PF('wg_entryform').hide()");
                PrimeFaces.current().ajax().update(":filterForm:dteliminasi");

                list = akeliminasiEjbHome.findAllByTahunBasJenisLap(tahun, idbas, idjnslaporan, kdPeriode);
            } else {
                System.out.println("SIMPAN 4");
                FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO,
                        "Info", "Kode Akun Eliminasi Sudah Ada");
                PrimeFaces.current().dialog().showMessageDynamic(message);
            }
        } catch (Exception ex) {
            System.out.println("GAGAL!");
            ex.printStackTrace();
//            FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Info!", "Kode Sudah Ada");
//            FacesContext.getCurrentInstance().addMessage(null, message);
            FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO,
                    "Info", "Kode Akun Eliminasi Sudah Ada");
            PrimeFaces.current().dialog().showMessageDynamic(message);
        }
        //this.list = service.findAll();
        return "index?faces-redirect=true";
    }

    public void delete(int id) {
        //obj = service.findByID(Integer.parseInt(id));
        //obj = periodeEjbHome.findByKode(kode);

        // akeliminasiEjbHome.delete(id);
        PrimeFaces.current().executeScript("PF('wg_entryform').hide()");
        PrimeFaces.current().ajax().update(":filterForm:dteliminasi");
        list = akeliminasiEjbHome.findAllByTahunBasJenisLap(tahun, idbas, idjnslaporan, kdPeriode);
    }

    public ArrayList<Integer> listTahun() {

        ArrayList<Integer> numbers = new ArrayList<Integer>();
        for (int years = 2015; years <= Calendar.getInstance().get(Calendar.YEAR); years++) {
            numbers.add(years);
        }
        return (numbers);
    }

    //print
    public void printForm() {

        try {
            initExecute();
            super.prepareReport();

        } catch (Exception e) {
            // make your own exception handling
            e.printStackTrace();
        }

    }

    public void printFormProvinsi() {

        try {
            initExecuteProvinsi();
            super.prepareReport2();

        } catch (Exception e) {
            // make your own exception handling
            e.printStackTrace();
        }

    }

    public void printFormWilayah() {

        try {
            initExecuteWilayah();
            super.prepareReport3();

        } catch (Exception e) {
            // make your own exception handling
            e.printStackTrace();
        }

    }

    public void printFormExcel() {

        try {
            initExecute();
            //super.setExportOption(ExportOption.EXCEL);
            super.prepareReport();

        } catch (Exception e) {
            // make your own exception handling
            e.printStackTrace();
        }

    }

    public void initExecute() {
        setCOMPILE_FILE_NAME("laporanNasional");
    }

    public void initExecuteProvinsi() {
        setCOMPILE_FILE_NAME("laporanProvinsi");
    }

    public void initExecuteWilayah() {
        setCOMPILE_FILE_NAME("laporanWilayah");
    }

    @Override
    protected Map<String, Object> getReportParameters() {
        Map<String, Object> reportParameters = new HashMap<String, Object>();

        reportParameters.put("kdperiode", kdPeriode);
        reportParameters.put("tahun", tahun);
        reportParameters.put("idbas", idbas);
        reportParameters.put("idlap", idjnslaporan);

        String namalaporan = null;
        if (idjnslaporan == 1) {
            namalaporan = "LAPORAN REALISASI ANGGARAN ";
        } else if (idjnslaporan == 2) {
            namalaporan = "NERACA";
        } else if (idjnslaporan == 3) {
            namalaporan = "LAPORAN OPERASIONAL";
        } else {
            namalaporan = "-";
        }

        for (AkunEliminasi ob : listNasional) {
            String ab = this.refNama1(ob.getKdrek1(), idbas);
            System.out.println("AB : " + ab);
            System.out.println("AB : " + ob.getKdrek1());
            System.out.println("AB : " + idbas);
            reportParameters.put("namarek1", ab);

            String ab2 = this.refNama2(ob.getKdrek1(), ob.getKdrek2(), idbas);
            reportParameters.put("namarek2", ab2);

        }

        reportParameters.put("namalaporan", namalaporan);

        return reportParameters;
    }

    @Override
    protected Map<String, Object> getReportParameters2() {
        Map<String, Object> reportParameters = new HashMap<String, Object>();

        reportParameters.put("kdperiode", kdPeriode);
        reportParameters.put("tahun", tahun);
        reportParameters.put("idbas", idbas);
        reportParameters.put("idlap", idjnslaporan);
        reportParameters.put("kdprovinsi", kdPemda);

        String namaprovinsi = "-";

        namaprovinsi = pemdaEjbHome.findByKodeProv(kdPemda).getNama_pemda();

        String namalaporan = null;
        if (idjnslaporan == 1) {
            namalaporan = "LAPORAN REALISASI ANGGARAN ";
        } else if (idjnslaporan == 2) {
            namalaporan = "NERACA";
        } else if (idjnslaporan == 3) {
            namalaporan = "LAPORAN OPERASIONAL";
        } else {
            namalaporan = "-";
        }

        reportParameters.put("namalaporan", namalaporan);
        reportParameters.put("namaprovinsi", namaprovinsi);

        return reportParameters;
    }

    @Override
    protected Map<String, Object> getReportParameters3() {
        Map<String, Object> reportParameters = new HashMap<String, Object>();

        reportParameters.put("kdperiode", kdPeriode);
        reportParameters.put("tahun", tahun);
        reportParameters.put("idbas", idbas);
        reportParameters.put("idlap", idjnslaporan);
        reportParameters.put("kdwilayah", kdWilayah);

        String namawilayah = "-";

        namawilayah = pemdaEjbHome.findByKodeWilayah(kdWilayah).getNama();

        String namalaporan = null;
        if (idjnslaporan == 1) {
            namalaporan = "LAPORAN REALISASI ANGGARAN ";
        } else if (idjnslaporan == 2) {
            namalaporan = "NERACA";
        } else if (idjnslaporan == 3) {
            namalaporan = "LAPORAN OPERASIONAL";
        } else {
            namalaporan = "-";
        }

        reportParameters.put("namalaporan", namalaporan);
        reportParameters.put("namawilayah", namawilayah);

        return reportParameters;
    }

    public boolean boldText(String text) {
        int a = text.length();

        boolean value = false;
        if (a < 4) {
            value = true;
        } else {
            value = false;
        }

        return value;

    }

    public boolean boldTextNo(String text) {
        boolean value = false;

        try {
            System.out.println("TEXT " + text + " " + text.length());

            if (text.length() == 6) {
                String[] parts = text.split(".");
                System.out.println("Pecah " + parts[0] + " " + parts[1] + " " + parts[2]);
                System.out.println(parts.length);
                String part1 = parts[0];// 004
                String part2 = parts[1];
                String part3 = parts[2];
                int a = Integer.parseInt(part3);
                System.out.println("P1 " + part1);
                System.out.println("P2 " + part2);
                System.out.println("P3 " + part3);
                System.out.println("a " + a);

                if (a >= 90) {
                    value = true;
                    System.out.println(true);
                } else {
                    value = false;
                    System.out.println(false);
                }
            }
        } catch (Exception ex) {
            System.out.println("Gagal");
        }
        return value;
    }

    public void postProcessXLS(Object document) {

        XSSFWorkbook wb = (XSSFWorkbook) document;
        XSSFSheet sheet = wb.getSheetAt(0);
        XSSFRow header = sheet.getRow(0);

        Iterator<Row> rowIterator = sheet.iterator();

        if (rowIterator.hasNext()) {
            rowIterator.next();
        }

        while (rowIterator.hasNext()) {
            Row row = rowIterator.next();
            Iterator<Cell> cellIterator = row.cellIterator();
            while (cellIterator.hasNext()) {
                Cell cell = cellIterator.next();
                if (cell.getColumnIndex() > 1) {
                    if (!cell.getStringCellValue().isEmpty()) {
                        cell.setCellValue(Double.valueOf(cell.getStringCellValue().replace(",", "")));
                    }
                }
            }
        }
    }

    public AkunEliminasi getAkel() {
        return akel;
    }

    public void setAkel(AkunEliminasi akel) {
        this.akel = akel;
    }

    public AkunEliminasi getObj() {
        return obj;
    }

    public void setObj(AkunEliminasi obj) {
        this.obj = obj;
    }

    public List<AkunEliminasi> getList() {
        return list;
    }

    public void setList(List<AkunEliminasi> list) {
        this.list = list;
    }

    public List<JenisBas> getListjbas() {
        return listjbas;
    }

    public void setListjbas(List<JenisBas> listjbas) {
        this.listjbas = listjbas;
    }

    public List<JenisLaporan> getListjlaporan() {
        return listjlaporan;
    }

    public void setListjlaporan(List<JenisLaporan> listjlaporan) {
        this.listjlaporan = listjlaporan;
    }

    public int getIdbas() {
        return idbas;
    }

    public void setIdbas(int idbas) {
        this.idbas = idbas;
    }

    public int getTahun() {
        return tahun;
    }

    public void setTahun(int tahun) {
        this.tahun = tahun;
    }

    public int getIdjnslaporan() {
        return idjnslaporan;
    }

    public void setIdjnslaporan(int idjnslaporan) {
        this.idjnslaporan = idjnslaporan;
    }

    public AkunEliminasiEjbHome getAkeliminasiEjbHome() {
        return akeliminasiEjbHome;
    }

    public void setAkeliminasiEjbHome(AkunEliminasiEjbHome akeliminasiEjbHome) {
        this.akeliminasiEjbHome = akeliminasiEjbHome;
    }

    public JenisBasEjbHome getJenisBasEjbHome() {
        return jenisBasEjbHome;
    }

    public void setJenisBasEjbHome(JenisBasEjbHome jenisBasEjbHome) {
        this.jenisBasEjbHome = jenisBasEjbHome;
    }

    public JenisLaporanEjbHome getJenisLaporanEjbHome() {
        return jenisLaporanEjbHome;
    }

    public void setJenisLaporanEjbHome(JenisLaporanEjbHome jenisLaporanEjbHome) {
        this.jenisLaporanEjbHome = jenisLaporanEjbHome;
    }

    public List<AkunEliminasi> getListkode() {
        return listkode;
    }

    public void setListkode(List<AkunEliminasi> listkode) {
        this.listkode = listkode;
    }

    public List<Periode> getListperiode() {
        return listperiode;
    }

    public void setListperiode(List<Periode> listperiode) {
        this.listperiode = listperiode;
    }

    public List<AkunEliminasi> getListNasional() {
        return listNasional;
    }

    public void setListNasional(List<AkunEliminasi> listProv) {
        this.listNasional = listNasional;
    }

    public List<AkunEliminasi> getListWilayah() {
        return listWilayah;
    }

    public void setListWilayah(List<AkunEliminasi> listWilayah) {
        this.listWilayah = listWilayah;
    }

    public List<AkunEliminasi> getListProvinsi() {
        return listProvinsi;
    }

    public void setListProvinsi(List<AkunEliminasi> listProvinsi) {
        this.listProvinsi = listProvinsi;
    }

    public String getKdPeriode() {
        return kdPeriode;
    }

    public void setKdPeriode(String kdPeriode) {
        this.kdPeriode = kdPeriode;
    }

    public List<ReferensiPemda> getListProv() {
        return listProv;
    }

    public void setListProv(List<ReferensiPemda> listProv) {
        this.listProv = listProv;
    }

    public String getKdPemda() {
        return kdPemda;
    }

    public void setKdPemda(String kdPemda) {
        this.kdPemda = kdPemda;
    }

    public List<ReferensiWilayah> getListDataWilayah() {
        return listDataWilayah;
    }

    public void setListDataWilayah(List<ReferensiWilayah> listDataWilayah) {
        this.listDataWilayah = listDataWilayah;
    }

    public String getKdWilayah() {
        return kdWilayah;
    }

    public void setKdWilayah(String kdWilayah) {
        this.kdWilayah = kdWilayah;
    }

    public List<KategoriPemda> getListkatpemda() {
        return listkatpemda;
    }

    public void setListkatpemda(List<KategoriPemda> listkatpemda) {
        this.listkatpemda = listkatpemda;
    }

    public List<JenisTransfer> getListjtransfer() {
        return listjtransfer;
    }

    public void setListjtransfer(List<JenisTransfer> listjtransfer) {
        this.listjtransfer = listjtransfer;
    }

    public String getKdp() {
        return kdp;
    }

    public void setKdp(String kdp) {
        this.kdp = kdp;
    }

    public HeaderResiprokal getHd() {
        return hd;
    }

    public void setHd(HeaderResiprokal hd) {
        this.hd = hd;
    }

    public JenisBas getJb() {
        return jb;
    }

    public void setJb(JenisBas jb) {
        this.jb = jb;
    }

    public ReferensiPemda getRp() {
        return rp;
    }

    public void setRp(ReferensiPemda rp) {
        this.rp = rp;
    }

    public JenisLaporan getJl() {
        return jl;
    }

    public void setJl(JenisLaporan jl) {
        this.jl = jl;
    }

    public String getNamaprov() {
        return namaprov;
    }

    public void setNamaprov(String namaprov) {
        this.namaprov = namaprov;
    }

    public String getNamaperiode() {
        return namaperiode;
    }

    public void setNamaperiode(String namaperiode) {
        this.namaperiode = namaperiode;
    }

    public Periode getP() {
        return p;
    }

    public void setP(Periode p) {
        this.p = p;
    }

    public List<AkunEliminasi> getListProvinsiLak() {
        return listProvinsiLak;
    }

    public void setListProvinsiLak(List<AkunEliminasi> listProvinsiLak) {
        this.listProvinsiLak = listProvinsiLak;
    }

    public List<JenisLaporan> getListlak() {
        return listlak;
    }

    public void setListlak(List<JenisLaporan> listlak) {
        this.listlak = listlak;
    }

    public List<AkunEliminasi> getListNasionalLak() {
        return listNasionalLak;
    }

    public void setListNasionalLak(List<AkunEliminasi> listNasionalLak) {
        this.listNasionalLak = listNasionalLak;
    }

    public List<AkunEliminasi> getListWilayahLak() {
        return listWilayahLak;
    }

    public void setListWilayahLak(List<AkunEliminasi> listWilayahLak) {
        this.listWilayahLak = listWilayahLak;
    }

    public String getCOMPILE_FILE_NAME() {
        return COMPILE_FILE_NAME;
    }

    public void setCOMPILE_FILE_NAME(String COMPILE_FILE_NAME) {
        this.COMPILE_FILE_NAME = COMPILE_FILE_NAME;
    }

    @Override
    protected String getCompileFileName() {
        return this.COMPILE_FILE_NAME;
    }

    @Override
    protected String getCompileFileName2() {
        return this.COMPILE_FILE_NAME;
    }

    @Override
    protected String getCompileFileName3() {
        return this.COMPILE_FILE_NAME;
    }

    public List<HeaderResiprokal> getListResiprokal() {
        return listResiprokal;
    }

    public void setListResiprokal(List<HeaderResiprokal> listResiprokal) {
        this.listResiprokal = listResiprokal;
    }

}
