/*
 * 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 com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import com.google.gson.LongSerializationPolicy;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.Serializable;
import java.lang.reflect.Type;
import java.math.BigDecimal;
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 java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.faces.view.ViewScoped;
import javax.inject.Named;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
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.BaganAkunStandarEjbHome;
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.AkunEliminasiEksport;
import sikd.ikonsol.model.AkunEliminasiEksportLak;
import sikd.ikonsol.model.AkunEliminasiEksportLpe;
import sikd.ikonsol.model.AkunEliminasiEksportLpsal;
import sikd.ikonsol.model.BaganAkunStandar;
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 List<BaganAkunStandar> listlevel1,
            listlevel2, listlevel3;

    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, listNasionalEksport;
    private List<AkunEliminasi> listWilayah, listWilayahLak, listWilayahEksport;
    private List<AkunEliminasi> listProvinsi, listProvinsiLak, listProvinsiEksport;
    private List<AkunEliminasiEksport> listProvinsiEksport2;

    private List<AkunEliminasiEksport> listWilayahEksport2;

    private List<AkunEliminasiEksport> listNasionalEksport2;

    private List<AkunEliminasiEksportLak> listProvinsiEksportLak, listWilayahEksportLak, listNasionalEksportLak;

    private List<AkunEliminasiEksportLpe> listProvinsiEksportLpe, listWilayahEksportLpe, listNasionalEksportLpe;

    private List<AkunEliminasiEksportLpsal> listProvinsiEksportLpsal, listWilayahEksportLpsal, listNasionalEksportLpsal;

    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;

    @EJB
    BaganAkunStandarEjbHome baganakunstandarEjbHome;

    @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();

        try {
            listProvinsiEksport = akeliminasiEjbHome.findByListProvEksport(kdPeriode, idbas, idjnslaporan, tahun, kdPemda);

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

        try {
            listProvinsiEksport2 = akeliminasiEjbHome.findByListProvEksport2(kdPeriode, idbas, idjnslaporan, tahun, kdPemda);

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

        try {
            listWilayahEksport = akeliminasiEjbHome.findByListWilayahEksport(kdPeriode, idbas, idjnslaporan, tahun, kdWilayah);

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

        try {
            listWilayahEksport2 = akeliminasiEjbHome.findByListWilayahEksport2(kdPeriode, idbas, idjnslaporan, tahun, kdWilayah);

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

        try {
            listNasionalEksport = akeliminasiEjbHome.findByListNasionalEksport(kdPeriode, idbas, idjnslaporan, tahun);

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

        try {
            FacesContext context = FacesContext.getCurrentInstance();
            listProvinsiEksport = (List<AkunEliminasi>) context.getExternalContext().getSessionMap().get("IDITEM");
        } catch (Exception e) {
            // System.out.println(e);
        }

        try {
            FacesContext context = FacesContext.getCurrentInstance();
            listProvinsiEksport2 = (List<AkunEliminasiEksport>) context.getExternalContext().getSessionMap().get("IDITEMJSON");
        } catch (Exception e) {
            // System.out.println(e);
        }

        try {
            FacesContext context = FacesContext.getCurrentInstance();
            listWilayahEksport = (List<AkunEliminasi>) context.getExternalContext().getSessionMap().get("IDITEM2");
        } catch (Exception e) {
            // System.out.println(e);
        }

        try {
            FacesContext context = FacesContext.getCurrentInstance();
            listWilayahEksport2 = (List<AkunEliminasiEksport>) context.getExternalContext().getSessionMap().get("IDITEM2WIL");
        } catch (Exception e) {
            // System.out.println(e);
        }

        try {
            FacesContext context = FacesContext.getCurrentInstance();
            listNasionalEksport = (List<AkunEliminasi>) context.getExternalContext().getSessionMap().get("IDITEM3");
        } catch (Exception e) {
            // System.out.println(e);
        }

        try {
            FacesContext context = FacesContext.getCurrentInstance();
            listNasionalEksport2 = (List<AkunEliminasiEksport>) context.getExternalContext().getSessionMap().get("IDITEM3NAS");
        } catch (Exception e) {
            // System.out.println(e);
        }

        try {

            listProvinsiEksportLak = akeliminasiEjbHome.findAllByListProvEksportLak(kdPeriode, idjnslaporan, tahun, kdPemda);
            listProvinsiEksportLpe = akeliminasiEjbHome.findAllByListProvEksportLpe(kdPeriode, idjnslaporan, tahun, kdPemda);
            listProvinsiEksportLpsal = akeliminasiEjbHome.findAllByListProvEksportLpsal(kdPeriode, idjnslaporan, tahun, kdPemda);

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

        try {

            listWilayahEksportLak = akeliminasiEjbHome.findAllByListProvEksportLak(kdPeriode, idjnslaporan, tahun, kdPemda);
            listWilayahEksportLpe = akeliminasiEjbHome.findAllByListProvEksportLpe(kdPeriode, idjnslaporan, tahun, kdPemda);
            listWilayahEksportLpsal = akeliminasiEjbHome.findAllByListProvEksportLpsal(kdPeriode, idjnslaporan, tahun, kdPemda);

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

        try {

            listWilayahEksportLak = akeliminasiEjbHome.findAllByListWilEksportLak(kdPeriode, idjnslaporan, tahun, kdWilayah);
            listWilayahEksportLpe = akeliminasiEjbHome.findAllByListWilEksportLpe(kdPeriode, idjnslaporan, tahun, kdWilayah);
            listWilayahEksportLpsal = akeliminasiEjbHome.findAllByListWilEksportLpsal(kdPeriode, idjnslaporan, tahun, kdWilayah);

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

            listNasionalEksportLak = akeliminasiEjbHome.findAllByListNasEksportLak(kdPeriode, idjnslaporan, tahun);
            listNasionalEksportLpe = akeliminasiEjbHome.findAllByListNasEksportLpe(kdPeriode, idjnslaporan, tahun);
            listNasionalEksportLpsal = akeliminasiEjbHome.findAllByListNasEksportLpsal(kdPeriode, idjnslaporan, tahun);
        } catch (Exception e) {
            // System.out.print(e);
        }

    }

    public void add(int idheader) {

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

        listResiprokal = headerResiprokalEjbHome.findAkunResiprokal(idjnslaporan);
        listlevel1 = baganakunstandarEjbHome.findAllLevel1(idbas);

        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 reloadLaporanProvEksport() {

        try {
            listProvinsiEksport = akeliminasiEjbHome.findByListProvEksport(kdPeriode, idbas, idjnslaporan, tahun, kdPemda);
        } catch (Exception r) {
            //r.printStackTrace();
        }

    }

    public String load() {

        try {
            listProvinsiEksport = akeliminasiEjbHome.findByListProvEksport(kdPeriode, idbas, idjnslaporan, tahun, kdPemda);
            listProvinsiEksport2 = akeliminasiEjbHome.findByListProvEksport2(kdPeriode, idbas, idjnslaporan, tahun, kdPemda);

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

        this.saveToSession(listProvinsiEksport);

        this.saveToSession2(listProvinsiEksport2);

        FacesContext context = FacesContext.getCurrentInstance();
        //System.out.println("Bas " + id);
        HttpServletRequest oriquest
                = (HttpServletRequest) context.getExternalContext().getRequest();
        String nexurl = "/ikonsol/laporan/eksportlapprovinsi.sikd";
        try {
            context.getExternalContext()
                    .redirect(oriquest.getContextPath() + nexurl);// "/logbook/view.xhtml");
        } catch (IOException e) {
            e.printStackTrace();
        }
        return "view?faces-redirect=true";

    }

    private void saveToSession(List<AkunEliminasi> idx) {
        FacesContext context = FacesContext.getCurrentInstance();
        context.getExternalContext().getSessionMap()
                .put("IDITEM", idx);
        System.out.println("Session id " + idx);

    }

    private void saveToSession2(List<AkunEliminasiEksport> idx) {
        FacesContext context = FacesContext.getCurrentInstance();
        context.getExternalContext().getSessionMap()
                .put("IDITEMJSON", idx);
        System.out.println("Session id " + idx);

    }

    public void reloadLaporanWilayah() {

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

    }

    public void reloadLaporanWilayahEksport() {

        try {
            listWilayahEksport = akeliminasiEjbHome.findByListWilayahEksport(kdPeriode, idbas, idjnslaporan, tahun, kdWilayah);

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

    }

    public String loadwilayah() {

        try {
            listWilayahEksport = akeliminasiEjbHome.findByListWilayahEksport(kdPeriode, idbas, idjnslaporan, tahun, kdWilayah);
            listWilayahEksport2 = akeliminasiEjbHome.findByListWilayahEksport2(kdPeriode, idbas, idjnslaporan, tahun, kdWilayah);

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

        this.saveToSessionWilayah(listWilayahEksport);
        this.saveToSessionWilayah2(listWilayahEksport2);

        FacesContext context = FacesContext.getCurrentInstance();
        //System.out.println("Bas " + id);
        HttpServletRequest oriquest
                = (HttpServletRequest) context.getExternalContext().getRequest();
        String nexurl = "/ikonsol/laporan/eksportlapwilayah.sikd";
        try {
            context.getExternalContext()
                    .redirect(oriquest.getContextPath() + nexurl);// "/logbook/view.xhtml");
        } catch (IOException e) {
            e.printStackTrace();
        }
        return "view?faces-redirect=true";

    }

    private void saveToSessionWilayah(List<AkunEliminasi> idx) {
        FacesContext context = FacesContext.getCurrentInstance();
        context.getExternalContext().getSessionMap()
                .put("IDITEM2", idx);
        System.out.println("Session id " + idx);

    }

    private void saveToSessionWilayah2(List<AkunEliminasiEksport> idx) {
        FacesContext context = FacesContext.getCurrentInstance();
        context.getExternalContext().getSessionMap()
                .put("IDITEM2WIL", idx);
        System.out.println("Session id " + idx);

    }

    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 reloadLaporanEksport() {

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

    }

    public String loadnasional() {

        try {
            listNasionalEksport = akeliminasiEjbHome.findByListNasionalEksport(kdPeriode, idbas, idjnslaporan, tahun);
            listNasionalEksport2 = akeliminasiEjbHome.findByListNasionalEksport2(kdPeriode, idbas, idjnslaporan, tahun);

        } catch (Exception c) {
            // System.out.println("lnlistNasional.siec()" + listNasional.size());
        }

        this.saveToSessionNasional(listNasionalEksport);
        this.saveToSessionNasional2(listNasionalEksport2);

        FacesContext context = FacesContext.getCurrentInstance();
        //System.out.println("Bas " + id);
        HttpServletRequest oriquest
                = (HttpServletRequest) context.getExternalContext().getRequest();
        String nexurl = "/ikonsol/laporan/eksportlapnasional.sikd";
        try {
            context.getExternalContext()
                    .redirect(oriquest.getContextPath() + nexurl);// "/logbook/view.xhtml");
        } catch (IOException e) {
            e.printStackTrace();
        }
        return "view?faces-redirect=true";

    }

    private void saveToSessionNasional(List<AkunEliminasi> idx) {
        FacesContext context = FacesContext.getCurrentInstance();
        context.getExternalContext().getSessionMap()
                .put("IDITEM3", idx);
        System.out.println("Session id " + idx);

    }

    private void saveToSessionNasional2(List<AkunEliminasiEksport> idx) {
        FacesContext context = FacesContext.getCurrentInstance();
        context.getExternalContext().getSessionMap()
                .put("IDITEM3NAS", idx);
        System.out.println("Session id " + idx);

    }

    public void reloadLaporanProvLak() {

        try {
            listProvinsiLak = akeliminasiEjbHome.findAllByListProvLak(kdPeriode, idjnslaporan, tahun, kdPemda);
            if (idjnslaporan == 4) {
                listProvinsiEksportLak = akeliminasiEjbHome.findAllByListProvEksportLak(kdPeriode, idjnslaporan, tahun, kdPemda);
            }
            if (idjnslaporan == 5) {
                listProvinsiEksportLpe = akeliminasiEjbHome.findAllByListProvEksportLpe(kdPeriode, idjnslaporan, tahun, kdPemda);
            }
            if (idjnslaporan == 6) {
                listProvinsiEksportLpsal = akeliminasiEjbHome.findAllByListProvEksportLpsal(kdPeriode, idjnslaporan, tahun, kdPemda);
            }
        } catch (Exception r) {
            //r.printStackTrace();
        }

    }

    public void reloadLaporanWilayahLak() {

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

            if (idjnslaporan == 4) {
                listWilayahEksportLak = akeliminasiEjbHome.findAllByListWilEksportLak(kdPeriode, idjnslaporan, tahun, kdWilayah);
            }
            if (idjnslaporan == 5) {
                listWilayahEksportLpe = akeliminasiEjbHome.findAllByListWilEksportLpe(kdPeriode, idjnslaporan, tahun, kdWilayah);
            }
            if (idjnslaporan == 6) {
                listWilayahEksportLpsal = akeliminasiEjbHome.findAllByListWilEksportLpsal(kdPeriode, idjnslaporan, tahun, kdWilayah);
            }

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

    }

    public void reloadLaporanLak() {

        try {
            listNasionalLak = akeliminasiEjbHome.findByListNasionalLak(kdPeriode, idjnslaporan, tahun);
            
                if (idjnslaporan == 4) {
                listNasionalEksportLak = akeliminasiEjbHome.findAllByListNasEksportLak(kdPeriode, idjnslaporan, tahun);
            }
            if (idjnslaporan == 5) {
                listNasionalEksportLpe = akeliminasiEjbHome.findAllByListNasEksportLpe(kdPeriode, idjnslaporan, tahun);
            }
            if (idjnslaporan == 6) {
                listNasionalEksportLpsal = akeliminasiEjbHome.findAllByListNasEksportLpsal(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();
            name = "[--Rekening Tidak Terdaftar--]";
        }
        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) {
        //public BigDecimal refEliminasi(BigDecimal nilai, int kode1, int kode2, int kode3, int bast, String kdperiode1, String kdprov1, int idjnslap1, int tahun1) {

        double name = 0;
        //BigDecimal name = new BigDecimal(0);

        try {
            name = akeliminasiEjbHome.selectEliminasi(String.valueOf(kode1), String.valueOf(kode2), String.valueOf(kode3), bast, kdperiode1, kdprov1,
                    idjnslap1, tahun1).getNilaieliminasi();
            name = nilai - name;
            //name = nilai.subtract(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();
            //total = total.add(obj.getNilai());
        }

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

    }

    public double getSumEliminasi(int kdlvl1, int kdlvl2) {

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

        for (AkunEliminasi obj : listNasional) {

            total += obj.getNilaieliminasi();
            //total = total.add(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;
        //BigDecimal total = new BigDecimal(0);
        listProvinsi = akeliminasiEjbHome.findByListProvSummary(kdPeriode, idbas, idjnslaporan, tahun, kdPemda, kdlvl1, kdlvl2);

        for (AkunEliminasi obj : listProvinsi) {

            total += obj.getNilai();
            //total = total.add(obj.getNilai());
        }

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

    }

    public double getSumEliminasiProvinsi(int kdlvl1, int kdlvl2) {

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

        for (AkunEliminasi obj : listProvinsi) {

            //total = total.add(obj.getNilaieliminasi());
            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;
        //BigDecimal total = new BigDecimal(0);
        listWilayah = akeliminasiEjbHome.findByListWilayahSummary(kdPeriode, idbas, idjnslaporan, tahun, kdWilayah, kdlvl1, kdlvl2);

        for (AkunEliminasi obj : listWilayah) {

            total += obj.getNilai();
            //total = total.add(obj.getNilai());

        }
        return total;

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

    public double getSumEliminasiWilayah(int kdlvl1, int kdlvl2) {

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

        for (AkunEliminasi obj : listWilayah) {

            total += obj.getNilaieliminasi();
            //total = total.add(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);
            System.out.println("TES " + hd.getId());
            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");

            double eliminasi = 0;
            double nilaiawal = 0;

            try {
                eliminasi = akeliminasiEjbHome.selectEliminasiCari(String.valueOf(akel.getKdrek1()),
                        String.valueOf(akel.getKdrek2()),
                        String.valueOf(akel.getKdrek3()),
                        String.valueOf(akel.getKdrek4()),
                        akel.getIdbas(), akel.getKdperiode(), akel.getKdpemda(),
                        akel.getIdjnslaporan(), akel.getTahun()).getNilaieliminasi();

                nilaiawal = akeliminasiEjbHome.selectRawDataCari(String.valueOf(akel.getKdrek1()),
                        String.valueOf(akel.getKdrek2()),
                        String.valueOf(akel.getKdrek3()),
                        String.valueOf(akel.getKdrek4()),
                        akel.getIdbas(), akel.getKdperiode(), akel.getKdpemda(),
                        akel.getIdjnslaporan(), akel.getTahun()).getNilai();

                nilaiawal = nilaiawal - eliminasi;

                //name = nilai.subtract(name);
            } catch (Exception ex) {
                //ex.printStackTrace();
                eliminasi = 0;

                try {
                    nilaiawal = akeliminasiEjbHome.selectRawDataCari(String.valueOf(akel.getKdrek1()),
                            String.valueOf(akel.getKdrek2()),
                            String.valueOf(akel.getKdrek3()),
                            String.valueOf(akel.getKdrek4()),
                            akel.getIdbas(), akel.getKdperiode(), akel.getKdpemda(),
                            akel.getIdjnslaporan(), akel.getTahun()).getNilaieliminasi();

                    nilaiawal = nilaiawal - eliminasi;
                    //name = nilai.subtract(name);
                } catch (Exception ex2) {
                    //ex.printStackTrace();
                    eliminasi = 0;
                }

            }
            
            

            akel.setNilai(nilaiawal);
            akel.setNilaieliminasi(akel.getNilaieliminasi());
            
            System.out.println("Nilai awal : " + nilaiawal );
            System.out.println("Eliminasi : " + akel.getNilaieliminasi() );
            
            if(nilaiawal>akel.getNilaieliminasi()){
             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);
//            }
            } else {
                 FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO,
                    "Info", "Nilai Awal Lebih Besar Dari Nilai Eliminasi");
            PrimeFaces.current().dialog().showMessageDynamic(message);
             System.out.println("SIMPAN 5");
            }

            
        } 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) {

        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);
    }

    public void textJson() {
        //Gson gson = new Gson();

        try {

            //listProvinsiEksport2 = akeliminasiEjbHome.findByListProvEksport2(kdPeriode, idbas, idjnslaporan, tahun, kdPemda);
            FacesContext facesContext = FacesContext.getCurrentInstance();

            HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse();
//            GsonBuilder gsonBuilder = new GsonBuilder();
//            gsonBuilder.setLongSerializationPolicy(LongSerializationPolicy.STRING);
//
//            Gson gson = gsonBuilder.create();

            Gson gson = new GsonBuilder().
                    registerTypeAdapter(Double.class, new JsonSerializer<Double>() {
                        @Override
                        public JsonElement serialize(Double t, Type type, JsonSerializationContext jsc) {
                            BigDecimal bigValue = BigDecimal.valueOf(t);

                            return new JsonPrimitive(bigValue.toPlainString());
                        }
                    }).create();

            //Gson gson = builder.create();
            String employeeJsonString = gson.toJson(listProvinsiEksport2);

            PrintWriter out = response.getWriter();
            response.setHeader("Content-Disposition", "attachment;filename=file.json");
            response.setContentType("application/json");
            out.print(employeeJsonString);
            out.flush();
            facesContext.responseComplete();
        } catch (IOException ex) {
            Logger.getLogger(AkunEliminasiBeanCtrl.class.getName()).log(Level.SEVERE, null, ex);
        }

    }

    public void textJsonWilayah() {
        //Gson gson = new Gson();

        try {

            //listWilayahEksport2 = akeliminasiEjbHome.findByListWilayahEksport2(kdPeriode, idbas, idjnslaporan, tahun, kdWilayah);
            FacesContext facesContext = FacesContext.getCurrentInstance();

            HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse();
//            GsonBuilder gsonBuilder = new GsonBuilder();
//            gsonBuilder.setLongSerializationPolicy(LongSerializationPolicy.STRING);
//            Gson gson = gsonBuilder.create();

            Gson gson = new GsonBuilder().
                    registerTypeAdapter(Double.class, new JsonSerializer<Double>() {
                        @Override
                        public JsonElement serialize(Double t, Type type, JsonSerializationContext jsc) {
                            BigDecimal bigValue = BigDecimal.valueOf(t);

                            return new JsonPrimitive(bigValue.toPlainString());
                        }
                    }).create();

            String employeeJsonString = gson.toJson(listWilayahEksport2);

            PrintWriter out = response.getWriter();
            response.setHeader("Content-Disposition", "attachment;filename=file.json");
            response.setContentType("application/json");
            out.print(employeeJsonString);
            out.flush();
            facesContext.responseComplete();
        } catch (IOException ex) {
            Logger.getLogger(AkunEliminasiBeanCtrl.class.getName()).log(Level.SEVERE, null, ex);
        }

    }

    public void textJsonNasional() {
        //Gson gson = new Gson();

        try {

            //listNasionalEksport2 = akeliminasiEjbHome.findByListNasionalEksport2(kdPeriode, idbas, idjnslaporan, tahun);
            FacesContext facesContext = FacesContext.getCurrentInstance();

            HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse();
//            GsonBuilder gsonBuilder = new GsonBuilder();
//            gsonBuilder.setLongSerializationPolicy(LongSerializationPolicy.STRING);
//            Gson gson = gsonBuilder.create();

            Gson gson = new GsonBuilder().
                    registerTypeAdapter(Double.class, new JsonSerializer<Double>() {
                        @Override
                        public JsonElement serialize(Double t, Type type, JsonSerializationContext jsc) {
                            BigDecimal bigValue = BigDecimal.valueOf(t);

                            return new JsonPrimitive(bigValue.toPlainString());
                        }
                    }).create();

            String employeeJsonString = gson.toJson(listNasionalEksport2);

            PrintWriter out = response.getWriter();
            response.setHeader("Content-Disposition", "attachment;filename=file.json");
            response.setContentType("application/json");
            out.print(employeeJsonString);
            out.flush();
            facesContext.responseComplete();
        } catch (IOException ex) {
            Logger.getLogger(AkunEliminasiBeanCtrl.class.getName()).log(Level.SEVERE, null, ex);
        }

    }

    public void textJsonProvLak() {
        //Gson gson = new Gson();

        try {

            //listProvinsiEksport2 = akeliminasiEjbHome.findByListProvEksport2(kdPeriode, idbas, idjnslaporan, tahun, kdPemda);
            FacesContext facesContext = FacesContext.getCurrentInstance();

            HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse();
//            GsonBuilder gsonBuilder = new GsonBuilder();
//            gsonBuilder.setLongSerializationPolicy(LongSerializationPolicy.STRING);
//
//            Gson gson = gsonBuilder.create();

            Gson gson = new GsonBuilder().
                    registerTypeAdapter(Double.class, new JsonSerializer<Double>() {
                        @Override
                        public JsonElement serialize(Double t, Type type, JsonSerializationContext jsc) {
                            BigDecimal bigValue = BigDecimal.valueOf(t);

                            return new JsonPrimitive(bigValue.toPlainString());
                        }
                    }).create();

            //Gson gson = builder.create();
            String employeeJsonString = gson.toJson(listProvinsiEksportLak);

            PrintWriter out = response.getWriter();
            response.setHeader("Content-Disposition", "attachment;filename=file.json");
            response.setContentType("application/json");
            out.print(employeeJsonString);
            out.flush();
            facesContext.responseComplete();
        } catch (IOException ex) {
            Logger.getLogger(AkunEliminasiBeanCtrl.class.getName()).log(Level.SEVERE, null, ex);
        }

    }

    public void textJsonProvLpe() {
        //Gson gson = new Gson();

        try {

            //listProvinsiEksport2 = akeliminasiEjbHome.findByListProvEksport2(kdPeriode, idbas, idjnslaporan, tahun, kdPemda);
            FacesContext facesContext = FacesContext.getCurrentInstance();

            HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse();
//            GsonBuilder gsonBuilder = new GsonBuilder();
//            gsonBuilder.setLongSerializationPolicy(LongSerializationPolicy.STRING);
//
//            Gson gson = gsonBuilder.create();

            Gson gson = new GsonBuilder().
                    registerTypeAdapter(Double.class, new JsonSerializer<Double>() {
                        @Override
                        public JsonElement serialize(Double t, Type type, JsonSerializationContext jsc) {
                            BigDecimal bigValue = BigDecimal.valueOf(t);

                            return new JsonPrimitive(bigValue.toPlainString());
                        }
                    }).create();

            //Gson gson = builder.create();
            String employeeJsonString = gson.toJson(listProvinsiEksportLpe);

            PrintWriter out = response.getWriter();
            response.setHeader("Content-Disposition", "attachment;filename=file.json");
            response.setContentType("application/json");
            out.print(employeeJsonString);
            out.flush();
            facesContext.responseComplete();
        } catch (IOException ex) {
            Logger.getLogger(AkunEliminasiBeanCtrl.class.getName()).log(Level.SEVERE, null, ex);
        }

    }

    public void textJsonProvLpsal() {
        //Gson gson = new Gson();

        try {

            //listProvinsiEksport2 = akeliminasiEjbHome.findByListProvEksport2(kdPeriode, idbas, idjnslaporan, tahun, kdPemda);
            FacesContext facesContext = FacesContext.getCurrentInstance();

            HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse();
//            GsonBuilder gsonBuilder = new GsonBuilder();
//            gsonBuilder.setLongSerializationPolicy(LongSerializationPolicy.STRING);
//
//            Gson gson = gsonBuilder.create();

            Gson gson = new GsonBuilder().
                    registerTypeAdapter(Double.class, new JsonSerializer<Double>() {
                        @Override
                        public JsonElement serialize(Double t, Type type, JsonSerializationContext jsc) {
                            BigDecimal bigValue = BigDecimal.valueOf(t);

                            return new JsonPrimitive(bigValue.toPlainString());
                        }
                    }).create();

            //Gson gson = builder.create();
            String employeeJsonString = gson.toJson(listProvinsiEksportLpsal);

            PrintWriter out = response.getWriter();
            response.setHeader("Content-Disposition", "attachment;filename=file.json");
            response.setContentType("application/json");
            out.print(employeeJsonString);
            out.flush();
            facesContext.responseComplete();
        } catch (IOException ex) {
            Logger.getLogger(AkunEliminasiBeanCtrl.class.getName()).log(Level.SEVERE, null, ex);
        }

    }
    
      public void textJsonWilLak() {
        //Gson gson = new Gson();

        try {

            //listProvinsiEksport2 = akeliminasiEjbHome.findByListProvEksport2(kdPeriode, idbas, idjnslaporan, tahun, kdPemda);
            FacesContext facesContext = FacesContext.getCurrentInstance();

            HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse();
//            GsonBuilder gsonBuilder = new GsonBuilder();
//            gsonBuilder.setLongSerializationPolicy(LongSerializationPolicy.STRING);
//
//            Gson gson = gsonBuilder.create();

            Gson gson = new GsonBuilder().
                    registerTypeAdapter(Double.class, new JsonSerializer<Double>() {
                        @Override
                        public JsonElement serialize(Double t, Type type, JsonSerializationContext jsc) {
                            BigDecimal bigValue = BigDecimal.valueOf(t);

                            return new JsonPrimitive(bigValue.toPlainString());
                        }
                    }).create();

            //Gson gson = builder.create();
            String employeeJsonString = gson.toJson(listWilayahEksportLak);

            PrintWriter out = response.getWriter();
            response.setHeader("Content-Disposition", "attachment;filename=file.json");
            response.setContentType("application/json");
            out.print(employeeJsonString);
            out.flush();
            facesContext.responseComplete();
        } catch (IOException ex) {
            Logger.getLogger(AkunEliminasiBeanCtrl.class.getName()).log(Level.SEVERE, null, ex);
        }

    }

    public void textJsonWilLpe() {
        //Gson gson = new Gson();

        try {

            //listProvinsiEksport2 = akeliminasiEjbHome.findByListProvEksport2(kdPeriode, idbas, idjnslaporan, tahun, kdPemda);
            FacesContext facesContext = FacesContext.getCurrentInstance();

            HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse();
//            GsonBuilder gsonBuilder = new GsonBuilder();
//            gsonBuilder.setLongSerializationPolicy(LongSerializationPolicy.STRING);
//
//            Gson gson = gsonBuilder.create();

            Gson gson = new GsonBuilder().
                    registerTypeAdapter(Double.class, new JsonSerializer<Double>() {
                        @Override
                        public JsonElement serialize(Double t, Type type, JsonSerializationContext jsc) {
                            BigDecimal bigValue = BigDecimal.valueOf(t);

                            return new JsonPrimitive(bigValue.toPlainString());
                        }
                    }).create();

            //Gson gson = builder.create();
            String employeeJsonString = gson.toJson(listWilayahEksportLpe);

            PrintWriter out = response.getWriter();
            response.setHeader("Content-Disposition", "attachment;filename=file.json");
            response.setContentType("application/json");
            out.print(employeeJsonString);
            out.flush();
            facesContext.responseComplete();
        } catch (IOException ex) {
            Logger.getLogger(AkunEliminasiBeanCtrl.class.getName()).log(Level.SEVERE, null, ex);
        }

    }

    public void textJsonWilLpsal() {
        //Gson gson = new Gson();

        try {

            //listProvinsiEksport2 = akeliminasiEjbHome.findByListProvEksport2(kdPeriode, idbas, idjnslaporan, tahun, kdPemda);
            FacesContext facesContext = FacesContext.getCurrentInstance();

            HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse();
//            GsonBuilder gsonBuilder = new GsonBuilder();
//            gsonBuilder.setLongSerializationPolicy(LongSerializationPolicy.STRING);
//
//            Gson gson = gsonBuilder.create();

            Gson gson = new GsonBuilder().
                    registerTypeAdapter(Double.class, new JsonSerializer<Double>() {
                        @Override
                        public JsonElement serialize(Double t, Type type, JsonSerializationContext jsc) {
                            BigDecimal bigValue = BigDecimal.valueOf(t);

                            return new JsonPrimitive(bigValue.toPlainString());
                        }
                    }).create();

            //Gson gson = builder.create();
            String employeeJsonString = gson.toJson(listWilayahEksportLpsal);

            PrintWriter out = response.getWriter();
            response.setHeader("Content-Disposition", "attachment;filename=file.json");
            response.setContentType("application/json");
            out.print(employeeJsonString);
            out.flush();
            facesContext.responseComplete();
        } catch (IOException ex) {
            Logger.getLogger(AkunEliminasiBeanCtrl.class.getName()).log(Level.SEVERE, null, ex);
        }

    }
    
      public void textJsonNasLak() {
        //Gson gson = new Gson();

        try {

            //listProvinsiEksport2 = akeliminasiEjbHome.findByListProvEksport2(kdPeriode, idbas, idjnslaporan, tahun, kdPemda);
            FacesContext facesContext = FacesContext.getCurrentInstance();

            HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse();
//            GsonBuilder gsonBuilder = new GsonBuilder();
//            gsonBuilder.setLongSerializationPolicy(LongSerializationPolicy.STRING);
//
//            Gson gson = gsonBuilder.create();

            Gson gson = new GsonBuilder().
                    registerTypeAdapter(Double.class, new JsonSerializer<Double>() {
                        @Override
                        public JsonElement serialize(Double t, Type type, JsonSerializationContext jsc) {
                            BigDecimal bigValue = BigDecimal.valueOf(t);

                            return new JsonPrimitive(bigValue.toPlainString());
                        }
                    }).create();

            //Gson gson = builder.create();
            String employeeJsonString = gson.toJson(listNasionalEksportLak);

            PrintWriter out = response.getWriter();
            response.setHeader("Content-Disposition", "attachment;filename=file.json");
            response.setContentType("application/json");
            out.print(employeeJsonString);
            out.flush();
            facesContext.responseComplete();
        } catch (IOException ex) {
            Logger.getLogger(AkunEliminasiBeanCtrl.class.getName()).log(Level.SEVERE, null, ex);
        }

    }

    public void textJsonNasLpe() {
        //Gson gson = new Gson();

        try {

            //listProvinsiEksport2 = akeliminasiEjbHome.findByListProvEksport2(kdPeriode, idbas, idjnslaporan, tahun, kdPemda);
            FacesContext facesContext = FacesContext.getCurrentInstance();

            HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse();
//            GsonBuilder gsonBuilder = new GsonBuilder();
//            gsonBuilder.setLongSerializationPolicy(LongSerializationPolicy.STRING);
//
//            Gson gson = gsonBuilder.create();

            Gson gson = new GsonBuilder().
                    registerTypeAdapter(Double.class, new JsonSerializer<Double>() {
                        @Override
                        public JsonElement serialize(Double t, Type type, JsonSerializationContext jsc) {
                            BigDecimal bigValue = BigDecimal.valueOf(t);

                            return new JsonPrimitive(bigValue.toPlainString());
                        }
                    }).create();

            //Gson gson = builder.create();
            String employeeJsonString = gson.toJson(listNasionalEksportLpe);

            PrintWriter out = response.getWriter();
            response.setHeader("Content-Disposition", "attachment;filename=file.json");
            response.setContentType("application/json");
            out.print(employeeJsonString);
            out.flush();
            facesContext.responseComplete();
        } catch (IOException ex) {
            Logger.getLogger(AkunEliminasiBeanCtrl.class.getName()).log(Level.SEVERE, null, ex);
        }

    }

    public void textJsonNasLpsal() {
        //Gson gson = new Gson();

        try {

            //listProvinsiEksport2 = akeliminasiEjbHome.findByListProvEksport2(kdPeriode, idbas, idjnslaporan, tahun, kdPemda);
            FacesContext facesContext = FacesContext.getCurrentInstance();

            HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse();
//            GsonBuilder gsonBuilder = new GsonBuilder();
//            gsonBuilder.setLongSerializationPolicy(LongSerializationPolicy.STRING);
//
//            Gson gson = gsonBuilder.create();

            Gson gson = new GsonBuilder().
                    registerTypeAdapter(Double.class, new JsonSerializer<Double>() {
                        @Override
                        public JsonElement serialize(Double t, Type type, JsonSerializationContext jsc) {
                            BigDecimal bigValue = BigDecimal.valueOf(t);

                            return new JsonPrimitive(bigValue.toPlainString());
                        }
                    }).create();

            //Gson gson = builder.create();
            String employeeJsonString = gson.toJson(listNasionalEksportLpsal);

            PrintWriter out = response.getWriter();
            response.setHeader("Content-Disposition", "attachment;filename=file.json");
            response.setContentType("application/json");
            out.print(employeeJsonString);
            out.flush();
            facesContext.responseComplete();
        } catch (IOException ex) {
            Logger.getLogger(AkunEliminasiBeanCtrl.class.getName()).log(Level.SEVERE, null, ex);
        }

    }

    //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() {
        if (idjnslaporan == 1) {
            setCOMPILE_FILE_NAME("laporanNasLRA");
        } else if (idjnslaporan == 2) {
            setCOMPILE_FILE_NAME("laporanNasNeraca");
        } else if (idjnslaporan == 3) {
            setCOMPILE_FILE_NAME("laporanNasLO");
        } else if (idjnslaporan == 7) {
            setCOMPILE_FILE_NAME("laporanNasNeraca");
        } else {
            System.out.println("DO NOTHING");
        }
    }

    public void initExecuteProvinsi() {
        if (idjnslaporan == 1) {
            setCOMPILE_FILE_NAME("laporanProvinsiLRA");
        } else if (idjnslaporan == 2) {
            setCOMPILE_FILE_NAME("laporanProvinsiNeraca");
        } else if (idjnslaporan == 3) {
            setCOMPILE_FILE_NAME("laporanProvinsiLO");
        } else if (idjnslaporan == 7) {
            setCOMPILE_FILE_NAME("laporanProvinsiNeraca");
        } else {
            System.out.println("DO NOTHING");
        }
    }

    public void initExecuteWilayah() {
        if (idjnslaporan == 1) {
            setCOMPILE_FILE_NAME("laporanWilLRA");
        } else if (idjnslaporan == 2) {
            setCOMPILE_FILE_NAME("laporanWilNeraca");
        } else if (idjnslaporan == 3) {
            setCOMPILE_FILE_NAME("laporanWilLO");
        } else if (idjnslaporan == 7) {
            setCOMPILE_FILE_NAME("laporanWilNeraca");
        } else {
            System.out.println("DO NOTHING");
        }
    }

    @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 if (idjnslaporan == 7) {
            namalaporan = "NERACA";
        } 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>();
        int sub1 = 0, sub2 = 0, sub3 = 0, sub4 = 0, sub5 = 0, sub6 = 0, sub7 = 0, sub8 = 0, sub9 = 0;;
        reportParameters.put("kdperiode", kdPeriode);
        reportParameters.put("tahun", tahun);
        reportParameters.put("idbas", idbas);
        reportParameters.put("idlap", idjnslaporan);
        reportParameters.put("kdprovinsi", kdPemda);

//        reportParameters.put("Sub1", sub1);
//        reportParameters.put("Sub2", sub2);
//        reportParameters.put("Sub3", sub3);
//        reportParameters.put("Sub4", sub4);
//        reportParameters.put("Sub5", sub5);
//        reportParameters.put("Sub6", sub6);
//        reportParameters.put("Sub7", sub7);
//        reportParameters.put("Sub8", sub8);
//        reportParameters.put("Sub9", sub9);
        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 if (idjnslaporan == 7) {
            namalaporan = "NERACA";
        } 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 if (idjnslaporan == 7) {
            namalaporan = "NERACA";
        } 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() > 9) {
                    if (cell.getRowIndex() > 1) {
                        if (!cell.getStringCellValue().isEmpty()) {
                            cell.setCellValue(Double.valueOf(cell.getStringCellValue().replace(",", "")));
                        }
                    }
                }
            }
        }
    }

    public void postProcessXLSLak(Object document) {

        HSSFWorkbook wb = (HSSFWorkbook) document;
        HSSFSheet sheet = wb.getSheetAt(0);
        HSSFRow 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.getRowIndex() > 2) {
                        if (!cell.getStringCellValue().isEmpty()) {
                            cell.setCellValue(Double.valueOf(cell.getStringCellValue().replace(",", "")));
                        }
                    }
                }
            }
        }

    }

    public void postProcessXLSLpeLpsal(Object document) {

        HSSFWorkbook wb = (HSSFWorkbook) document;
        HSSFSheet sheet = wb.getSheetAt(0);
        HSSFRow 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.getRowIndex() > 0) {
                        if (!cell.getStringCellValue().isEmpty()) {
                            cell.setCellValue(Double.valueOf(cell.getStringCellValue().replace(",", "")));
                        }
                    }
                }
            }
        }

    }

    public void postProcessEksport(Object document) {

        HSSFWorkbook wb = (HSSFWorkbook) document;
        HSSFSheet sheet = wb.getSheetAt(0);
        HSSFRow 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() > 8 && cell.getColumnIndex() < 11) {
                    if (cell.getRowIndex() > 0) {
                        if (!cell.getStringCellValue().isEmpty()) {
                            cell.setCellValue(Double.valueOf(cell.getStringCellValue().replace(",", "")));
                        }
                    }
                }
            }
        }

    }
    
     public void postProcessEksportNasional(Object document) {

        HSSFWorkbook wb = (HSSFWorkbook) document;
        HSSFSheet sheet = wb.getSheetAt(0);
        HSSFRow 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() > 7 && cell.getColumnIndex() < 10) {
                    if (cell.getRowIndex() > 0) {
                        if (!cell.getStringCellValue().isEmpty()) {
                            cell.setCellValue(Double.valueOf(cell.getStringCellValue().replace(",", "")));
                        }
                    }
                }
            }
        }

    }

    public void onDatas() {
        if (akel != null) {
            System.out.println("ZXZXZXZX");
            listlevel2 = baganakunstandarEjbHome.findAllLevel2ByLevel1(akel.getKdrek1(), idbas);
            System.out.println("DATA ADA");
            System.out.println(akel.getKdrek1());
        }
    }

    public void onDatas2() {
        if (akel != null) {
            listlevel3 = baganakunstandarEjbHome.findAllLevel3ByLevel2(akel.getKdrek2(), idbas);
        }

    }

    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;
    }

    public List<BaganAkunStandar> getListlevel1() {
        return listlevel1;
    }

    public void setListlevel1(List<BaganAkunStandar> listlevel1) {
        this.listlevel1 = listlevel1;
    }

    public List<BaganAkunStandar> getListlevel2() {
        return listlevel2;
    }

    public void setListlevel2(List<BaganAkunStandar> listlevel2) {
        this.listlevel2 = listlevel2;
    }

    public List<BaganAkunStandar> getListlevel3() {
        return listlevel3;
    }

    public void setListlevel3(List<BaganAkunStandar> listlevel3) {
        this.listlevel3 = listlevel3;
    }

    public List<AkunEliminasi> getListProvinsiEksport() {
        return listProvinsiEksport;
    }

    public void setListProvinsiEksport(List<AkunEliminasi> listProvinsiEksport) {
        this.listProvinsiEksport = listProvinsiEksport;
    }

    public List<AkunEliminasi> getListWilayahEksport() {
        return listWilayahEksport;
    }

    public void setListWilayahEksport(List<AkunEliminasi> listWilayahEksport) {
        this.listWilayahEksport = listWilayahEksport;
    }

    public List<AkunEliminasi> getListNasionalEksport() {
        return listNasionalEksport;
    }

    public void setListNasionalEksport(List<AkunEliminasi> listNasionalEksport) {
        this.listNasionalEksport = listNasionalEksport;
    }

    public List<AkunEliminasiEksport> getListProvinsiEksport2() {
        return listProvinsiEksport2;
    }

    public void setListProvinsiEksport2(List<AkunEliminasiEksport> listProvinsiEksport2) {
        this.listProvinsiEksport2 = listProvinsiEksport2;
    }

    public List<AkunEliminasiEksport> getListWilayahEksport2() {
        return listWilayahEksport2;
    }

    public void setListWilayahEksport2(List<AkunEliminasiEksport> listWilayahEksport2) {
        this.listWilayahEksport2 = listWilayahEksport2;
    }

    public List<AkunEliminasiEksport> getListNasionalEksport2() {
        return listNasionalEksport2;
    }

    public void setListNasionalEksport2(List<AkunEliminasiEksport> listNasionalEksport2) {
        this.listNasionalEksport2 = listNasionalEksport2;
    }

    public List<AkunEliminasiEksportLak> getListProvinsiEksportLak() {
        return listProvinsiEksportLak;
    }

    public void setListProvinsiEksportLak(List<AkunEliminasiEksportLak> listProvinsiEksportLak) {
        this.listProvinsiEksportLak = listProvinsiEksportLak;
    }

    public List<AkunEliminasiEksportLpe> getListProvinsiEksportLpe() {
        return listProvinsiEksportLpe;
    }

    public void setListProvinsiEksportLpe(List<AkunEliminasiEksportLpe> listProvinsiEksportLpe) {
        this.listProvinsiEksportLpe = listProvinsiEksportLpe;
    }

    public List<AkunEliminasiEksportLpsal> getListProvinsiEksportLpsal() {
        return listProvinsiEksportLpsal;
    }

    public void setListProvinsiEksportLpsal(List<AkunEliminasiEksportLpsal> listProvinsiEksportLpsal) {
        this.listProvinsiEksportLpsal = listProvinsiEksportLpsal;
    }

    public List<AkunEliminasiEksportLak> getListWilayahEksportLak() {
        return listWilayahEksportLak;
    }

    public void setListWilayahEksportLak(List<AkunEliminasiEksportLak> listWilayahEksportLak) {
        this.listWilayahEksportLak = listWilayahEksportLak;
    }

    public List<AkunEliminasiEksportLak> getListNasionalEksportLak() {
        return listNasionalEksportLak;
    }

    public void setListNasionalEksportLak(List<AkunEliminasiEksportLak> listNasionalEksportLak) {
        this.listNasionalEksportLak = listNasionalEksportLak;
    }

    public List<AkunEliminasiEksportLpe> getListWilayahEksportLpe() {
        return listWilayahEksportLpe;
    }

    public void setListWilayahEksportLpe(List<AkunEliminasiEksportLpe> listWilayahEksportLpe) {
        this.listWilayahEksportLpe = listWilayahEksportLpe;
    }

    public List<AkunEliminasiEksportLpe> getListNasionalEksportLpe() {
        return listNasionalEksportLpe;
    }

    public void setListNasionalEksportLpe(List<AkunEliminasiEksportLpe> listNasionalEksportLpe) {
        this.listNasionalEksportLpe = listNasionalEksportLpe;
    }

    public List<AkunEliminasiEksportLpsal> getListWilayahEksportLpsal() {
        return listWilayahEksportLpsal;
    }

    public void setListWilayahEksportLpsal(List<AkunEliminasiEksportLpsal> listWilayahEksportLpsal) {
        this.listWilayahEksportLpsal = listWilayahEksportLpsal;
    }

    public List<AkunEliminasiEksportLpsal> getListNasionalEksportLpsal() {
        return listNasionalEksportLpsal;
    }

    public void setListNasionalEksportLpsal(List<AkunEliminasiEksportLpsal> listNasionalEksportLpsal) {
        this.listNasionalEksportLpsal = listNasionalEksportLpsal;
    }
    
    

}
