/*
 * 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.util.ArrayList;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.application.FacesMessage;
import javax.faces.view.ViewScoped;
import javax.inject.Named;
import org.primefaces.PrimeFaces;
import sikd.ikonsol.ejb.session.AkunResiprokalEjbHome;
import sikd.ikonsol.ejb.session.BaganAkunStandarEjbHome;
import sikd.ikonsol.ejb.session.HeaderResiprokalEjbHome;
import sikd.ikonsol.ejb.session.KategoriPemdaEjbHome;
import sikd.ikonsol.model.AkunResiprokal;
import sikd.ikonsol.model.BaganAkunStandar;
import sikd.ikonsol.model.HeaderResiprokal;
import sikd.ikonsol.model.KategoriPemda;

/**
 *
 * @author Imam Bhoim
 */
@ViewScoped
@Named(value = "akunResiprokalBeanCtrl")
public class AkunResiprokalBeanCtrl implements Serializable {
    
     private List<BaganAkunStandar> listlevel1,
            listlevel2, listlevel3;

    AkunResiprokal akunres, akunrespasangdeb, akunrespasangkre;
    AkunResiprokal obj;
    AkunResiprokal obj2;

    HeaderResiprokal hd;
    private List<AkunResiprokal> list, listkode;

    private List<HeaderResiprokal> listheaderres;
    private List<KategoriPemda> listkatpemda;

    private int idbasakunres = 0;

    private int headerid = 0;

    @EJB
    HeaderResiprokalEjbHome headerResiprokalEjbHome;

    @EJB
    AkunResiprokalEjbHome akunResiprokalEjbHome;

    @EJB
    KategoriPemdaEjbHome katPemdaEjbHome;
    
    
    @EJB
    BaganAkunStandarEjbHome baganakunstandarEjbHome;

    @PostConstruct
    public void init() {

        list = akunResiprokalEjbHome.findAll();
    }

    public void add() {

        akunres = akunResiprokalEjbHome.createNew();
//        listjlapor = headerResiprokalEjbHome.findAllJLaporan();
//        System.out.println(listjlapor.size() + " AAA");
//        listjtransfer = headerResiprokalEjbHome.findAllJtransfer();
//        System.out.println(listjtransfer.size() + " BBB ");

        listheaderres = headerResiprokalEjbHome.findAll();
        listkatpemda = katPemdaEjbHome.findAll();
        listlevel1 = baganakunstandarEjbHome.findAllLevel1(idbasakunres);


    }

    public void addPasangan() {

        akunrespasangdeb = akunResiprokalEjbHome.createNew();
        akunrespasangkre = akunResiprokalEjbHome.createNew();
//        listjlapor = headerResiprokalEjbHome.findAllJLaporan();
//        System.out.println(listjlapor.size() + " AAA");
//        listjtransfer = headerResiprokalEjbHome.findAllJtransfer();
//        System.out.println(listjtransfer.size() + " BBB ");

        listheaderres = headerResiprokalEjbHome.findAll();
        listkatpemda = katPemdaEjbHome.findAll();
          listlevel1 = baganakunstandarEjbHome.findAllLevel1(idbasakunres);

    }

    public String save() {

        AkunResiprokal ar = new AkunResiprokal();
//        System.out.println(" Header ID " + headerid + " idbas " + idbasakunres);
//        System.out.println("A1 " + akunres.getKdlevel1());
//        System.out.println("A2 " + akunres.getKdlevel2());
//        System.out.println("A3 " + akunres.getKdlevel3());
//        System.out.println("A4 " + akunres.getKdlevel4());
//        System.out.println("A5 " + akunres.getKdlevel5());
//        System.out.println("idbas " + idbasakunres);
//        System.out.println("header res " + headerid);
        ar = akunResiprokalEjbHome.findByKodeAkunHeader(akunres.getKdlevel1(), akunres.getKdlevel2(),
                akunres.getKdlevel3(), akunres.getKdlevel4(), akunres.getKdlevel5(), idbasakunres,
                headerid);
        try {
            if (ar == null) {

                akunres.setHeader_id_resipro(headerid);
                akunres.setIdbas(idbasakunres);

                String kdrek4 = akunres.getKdlevel4().trim();
                String kdrek5 = akunres.getKdlevel5().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;
                }

                akunres.setKdlevel4(kdrek4);
                akunres.setKdlevel5(kdrek5);

                akunres.setFlag("8");

                akunResiprokalEjbHome.save(akunres);
                System.out.println("SIMPAN 3");

                PrimeFaces.current().executeScript("PF('wg_entryform1').hide()");
                PrimeFaces.current().ajax().update(":master:dtheaderres");

                list = akunResiprokalEjbHome.findAll();
            } else {
                System.out.println("SIMPAN 4");
                FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO,
                        "Info", "Kode Akun Resiprokal 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 Resiprokal Sudah Ada");
            PrimeFaces.current().dialog().showMessageDynamic(message);
        }
        //this.list = service.findAll();
        return "index?faces-redirect=true";
    }

    public String update() {

        AkunResiprokal ar = new AkunResiprokal();
        AkunResiprokal ar2 = new AkunResiprokal();

        ar = akunResiprokalEjbHome.findByKodeAkunHeader(obj.getKdlevel1(), obj.getKdlevel2(),
                obj.getKdlevel3(), obj.getKdlevel4(), obj.getKdlevel5(),
                idbasakunres, obj.getHeader_id_resipro());

        ar2 = akunResiprokalEjbHome.findByKodeAkunHeaderLengkap(obj.getKdlevel1(), obj.getKdlevel2(),
                obj.getKdlevel3(), obj.getKdlevel4(), obj.getKdlevel5(),
                idbasakunres, obj.getHeader_id_resipro(), obj.getDk(), obj.getId_kategori_pemda(),
                obj.getFlag());
//
//        System.out.println("OBJ1 " + obj.getKdlevel1() + " AR" + ar.getKdlevel1());
//        System.out.println("OBJ1 " + obj.getKdlevel2() + " AR" + ar.getKdlevel2());
//        System.out.println("OBJ1 " + obj.getKdlevel3() + " AR" + ar.getKdlevel3());
//        System.out.println("OBJ1 " + obj.getKdlevel4() + " AR" + ar.getKdlevel4());
//        System.out.println("OBJ1 " + obj.getKdlevel5() + " AR" + ar.getKdlevel5());
//        System.out.println("OBJ1 " + headerid + " AR" + ar.getHeader_id_resipro());
//        System.out.println("OBJ1 " + idbasakunres + " AR" + ar.getIdbas());

        try {
            if (ar == null) {

                String kdrek4 = obj.getKdlevel4().trim();
                String kdrek5 = obj.getKdlevel5().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;
                }

                obj.setKdlevel4(kdrek4);
                obj.setKdlevel5(kdrek5);

                obj.setFlag("8");

                akunResiprokalEjbHome.update(obj);
                System.out.println("SIMPAN 3");

                PrimeFaces.current().executeScript("PF('wg_entryform1_ubah').hide()");
                PrimeFaces.current().ajax().update(":master:dtheaderres");

                list = akunResiprokalEjbHome.findAll();

            } else {

                if (ar2 == null) {

                    String kdrek4 = obj.getKdlevel4().trim();
                    String kdrek5 = obj.getKdlevel5().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;
                    }

                    obj.setKdlevel4(kdrek4);
                    obj.setKdlevel5(kdrek5);

                    akunResiprokalEjbHome.update(obj);
                    System.out.println("SIMPAN 4");

                    PrimeFaces.current().executeScript("PF('wg_entryform1_ubah').hide()");
                    PrimeFaces.current().ajax().update(":master:dtheaderres");

                    list = akunResiprokalEjbHome.findAll();
                } else {
                    System.out.println("SIMPAN 5");
                    FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO,
                            "Info", "Kode Akun Resiprokal 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 Resiprokal Sudah Ada");
            PrimeFaces.current().dialog().showMessageDynamic(message);
        }
        return "index?faces-redirect=true";
    }

    public String savePasangan() {

        AkunResiprokal ar = new AkunResiprokal();
        AkunResiprokal ar2 = new AkunResiprokal();
//        System.out.println(" Header ID " + headerid + " idbas " + idbasakunres);
//        System.out.println("A1 " + akunres.getKdlevel1());
//        System.out.println("A2 " + akunres.getKdlevel2());
//        System.out.println("A3 " + akunres.getKdlevel3());
//        System.out.println("A4 " + akunres.getKdlevel4());
//        System.out.println("A5 " + akunres.getKdlevel5());
//        System.out.println("idbas " + idbasakunres);
//        System.out.println("header res " + headerid);
        ar = akunResiprokalEjbHome.findByKodeAkunHeader(akunrespasangdeb.getKdlevel1(), akunrespasangdeb.getKdlevel2(),
                akunrespasangdeb.getKdlevel3(), akunrespasangdeb.getKdlevel4(), akunrespasangdeb.getKdlevel5(), idbasakunres,
                headerid);

        ar2 = akunResiprokalEjbHome.findByKodeAkunHeader(akunrespasangkre.getKdlevel1(), akunrespasangkre.getKdlevel2(),
                akunrespasangkre.getKdlevel3(), akunrespasangkre.getKdlevel4(),
                akunrespasangkre.getKdlevel5(), idbasakunres,
                headerid);
        try {
            if ((ar == null) || (ar2 == null)) {

                akunrespasangdeb.setHeader_id_resipro(headerid);
                akunrespasangdeb.setIdbas(idbasakunres);

                akunrespasangkre.setHeader_id_resipro(headerid);
                akunrespasangkre.setIdbas(idbasakunres);

                String kdrek4 = akunrespasangdeb.getKdlevel4().trim();
                String kdrek5 = akunrespasangdeb.getKdlevel5().trim();

                String kdrek4a = akunrespasangkre.getKdlevel4().trim();
                String kdrek5a = akunrespasangkre.getKdlevel5().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;
                }

                akunrespasangdeb.setKdlevel4(kdrek4);
                akunrespasangdeb.setKdlevel5(kdrek5);

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

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

                akunrespasangkre.setKdlevel4(kdrek4a);
                akunrespasangkre.setKdlevel5(kdrek5a);

                String debp = String.valueOf(akunrespasangdeb.getKdlevel1()) + 
                        String.valueOf(akunrespasangdeb.getKdlevel2()) + 
                        String.valueOf(akunrespasangdeb.getKdlevel3())
                        + akunrespasangdeb.getKdlevel4() + akunrespasangdeb.getKdlevel5();

                System.out.println("AA " + debp);
                
                akunrespasangdeb.setFlag(debp);
                akunrespasangkre.setFlag(debp);

                akunResiprokalEjbHome.save(akunrespasangdeb);
                akunResiprokalEjbHome.save(akunrespasangkre);
                System.out.println("SIMPAN 3");

                PrimeFaces.current().executeScript("PF('wg_entryformpasang').hide()");
                PrimeFaces.current().ajax().update(":master:dtheaderres");

                list = akunResiprokalEjbHome.findAll();
            } else {
                System.out.println("SIMPAN 4");
                FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO,
                        "Info", "Kode Akun Resiprokal 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 Resiprokal Sudah Ada");
            PrimeFaces.current().dialog().showMessageDynamic(message);
        }
        //this.list = service.findAll();
        return "index?faces-redirect=true";
    }

    public void edit(int id) {
        //obj = service.findByID(Integer.parseInt(id));
        obj = akunResiprokalEjbHome.findByID(id);

        listheaderres = headerResiprokalEjbHome.findAll();
        listkatpemda = katPemdaEjbHome.findAll();
    }

    public void delete(int id) {
        akunResiprokalEjbHome.delete(id);
        PrimeFaces.current().ajax().update(":master:dtheaderres");
        list = akunResiprokalEjbHome.findAll();
    }

    public ArrayList<String> pasanganData() {

        ArrayList<String> numbers = new ArrayList<String>();

        numbers.add("1");
        numbers.add("2");
        numbers.add("3");
        numbers.add("4");
        numbers.add("5");
        numbers.add("8");
        return (numbers);
    }

    public void listkode(int idheader) {

        listkode = akunResiprokalEjbHome.findByIdHeader(idheader);

        hd = headerResiprokalEjbHome.findByID(idheader);

        headerid = idheader;
        idbasakunres = hd.getIdbas();
    }
    
     public void onDatas() {
        if (akunres != null) {
            System.out.println("ZXZXZXZX");
            listlevel2 = baganakunstandarEjbHome.findAllLevel2ByLevel1(akunres.getKdlevel1(), idbasakunres);
            System.out.println("DATA ADA");
//            System.out.println(akel.getKdrek1());
        }
    }

    public void onDatas2() {
        if (akunres != null) {
            listlevel3 = baganakunstandarEjbHome.findAllLevel3ByLevel2(akunres.getKdlevel2(), idbasakunres);
        }

    }
    
     public void onDatasD() {
        if (akunrespasangdeb != null) {
            System.out.println("ZXZXZXZX");
            listlevel2 = baganakunstandarEjbHome.findAllLevel2ByLevel1(akunrespasangdeb.getKdlevel1(), idbasakunres);
            System.out.println("DATA ADA");
//            System.out.println(akel.getKdrek1());
        }
    }

    public void onDatas2D() {
        if (akunrespasangdeb != null) {
            listlevel3 = baganakunstandarEjbHome.findAllLevel3ByLevel2(akunrespasangdeb.getKdlevel2(), idbasakunres);
        }

    }
    
     public void onDatasK() {
        if (akunrespasangkre != null) {
            System.out.println("ZXZXZXZX");
            listlevel2 = baganakunstandarEjbHome.findAllLevel2ByLevel1(akunrespasangkre.getKdlevel1(), idbasakunres);
            System.out.println("DATA ADA");
//            System.out.println(akel.getKdrek1());
        }
    }

    public void onDatas2K() {
        if (akunrespasangkre != null) {
            listlevel3 = baganakunstandarEjbHome.findAllLevel3ByLevel2(akunrespasangkre.getKdlevel2(), idbasakunres);
        }

    }

    public AkunResiprokal getAkunres() {
        return akunres;
    }

    public void setAkunres(AkunResiprokal akunres) {
        this.akunres = akunres;
    }

    public AkunResiprokal getObj() {
        return obj;
    }

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

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

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

    public List<HeaderResiprokal> getListheaderres() {
        return listheaderres;
    }

    public void setListheaderres(List<HeaderResiprokal> listheaderres) {
        this.listheaderres = listheaderres;
    }

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

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

    public HeaderResiprokalEjbHome getHeaderResiprokalEjbHome() {
        return headerResiprokalEjbHome;
    }

    public void setHeaderResiprokalEjbHome(HeaderResiprokalEjbHome headerResiprokalEjbHome) {
        this.headerResiprokalEjbHome = headerResiprokalEjbHome;
    }

    public AkunResiprokalEjbHome getAkunResiprokalEjbHome() {
        return akunResiprokalEjbHome;
    }

    public void setAkunResiprokalEjbHome(AkunResiprokalEjbHome akunResiprokalEjbHome) {
        this.akunResiprokalEjbHome = akunResiprokalEjbHome;
    }

    public KategoriPemdaEjbHome getKatPemdaEjbHome() {
        return katPemdaEjbHome;
    }

    public void setKatPemdaEjbHome(KategoriPemdaEjbHome katPemdaEjbHome) {
        this.katPemdaEjbHome = katPemdaEjbHome;
    }

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

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

    public HeaderResiprokal getHd() {
        return hd;
    }

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

    public int getIdbasakunres() {
        return idbasakunres;
    }

    public void setIdbasakunres(int idbasakunres) {
        this.idbasakunres = idbasakunres;
    }

    public int getHeaderid() {
        return headerid;
    }

    public void setHeaderid(int headerid) {
        this.headerid = headerid;
    }

    public AkunResiprokal getObj2() {
        return obj2;
    }

    public void setObj2(AkunResiprokal obj2) {
        this.obj2 = obj2;
    }

    public AkunResiprokal getAkunrespasangdeb() {
        return akunrespasangdeb;
    }

    public void setAkunrespasangdeb(AkunResiprokal akunrespasangdeb) {
        this.akunrespasangdeb = akunrespasangdeb;
    }

    public AkunResiprokal getAkunrespasangkre() {
        return akunrespasangkre;
    }

    public void setAkunrespasangkre(AkunResiprokal akunrespasangkre) {
        this.akunrespasangkre = akunrespasangkre;
    }

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

}
