package sikd.sikd5.sikd5ejb.dao;

import java.util.ArrayList;
import java.util.List;

import org.apache.ibatis.session.SqlSession;

import sikd.sikd5.sikd5bean.fault.SIKDServiceException;
import sikd.sikd5.sikd5bean.laporan.Lampiran1Apbd;
import sikd.sikd5.sikd5ejb.mapper.LaporanMapper;

/**
 *
 * @author : soraturaes
 */
public class LaporanDao {
    
                    
	public List<Lampiran1Apbd> getLaporanApbdNasional(short tahun, SqlSession session)
			throws SIKDServiceException {
		List<Lampiran1Apbd> hasil = new ArrayList();
		try {
                    LaporanMapper mapper = session.getMapper(LaporanMapper.class);
			hasil = mapper.getLaporanApbdNasional(tahun);
                        if(hasil!=null && !hasil.isEmpty()){
                            for (Lampiran1Apbd hh : hasil) {
                                if( hh.getNomor()!=null && hh.getNomor().trim().length() <4 ){
                                    hh.setStyle("font-weight: bold; ");
                                }
                            }
                        }
			return hasil;
		} catch (Exception e) {
                    e.printStackTrace();
			throw new SIKDServiceException(e.getMessage());
		}
	}
        
	public List<Lampiran1Apbd> getLaporanApbdPemda(short tahun, String kodesatker, SqlSession session)
			throws SIKDServiceException {
		List<Lampiran1Apbd> hasil = new ArrayList();
		try {
			LaporanMapper mapper = session.getMapper(LaporanMapper.class);
			hasil = mapper.getLaporanApbdPemda(tahun, kodesatker);
                        if(hasil!=null && !hasil.isEmpty()){
                            for (Lampiran1Apbd hh : hasil) {
                                if( hh.getNomor()!=null && hh.getNomor().trim().length() <4 ){
                                    hh.setStyle("font-weight: bold; ");
                                }
                            }
                        }
			return hasil;
		} catch (Exception e) {
                    e.printStackTrace();
			throw new SIKDServiceException(e.getMessage());
		}
	}
        
	public List<Lampiran1Apbd> getLaporanPostingedLraNasional(String tanggal1, String tanggal2, SqlSession session)
			throws SIKDServiceException {
		List<Lampiran1Apbd> hasil = new ArrayList();
		try {
                    LaporanMapper mapper = session.getMapper(LaporanMapper.class);
			hasil = mapper.getLaporanPostingedLraNasional(tanggal1, tanggal2);
                        if(hasil!=null && !hasil.isEmpty()){
                            for (Lampiran1Apbd hh : hasil) {
                                if( hh.getNomor()!=null && hh.getNomor().trim().length() <4 ){
                                    hh.setStyle("font-weight: bold; ");
                                }
                            }
                        }
			return hasil;
		} catch (Exception e) {
                    e.printStackTrace();
			throw new SIKDServiceException(e.getMessage());
		}
	}
        
	public List<Lampiran1Apbd> getLaporanPostingedLraPemda(String tanggal1, String tanggal2, String kodesatker, SqlSession session)
			throws SIKDServiceException {
		List<Lampiran1Apbd> hasil = new ArrayList();
		try {
			LaporanMapper mapper = session.getMapper(LaporanMapper.class);
			hasil = mapper.getLaporanPostingedLraPemda(tanggal1, tanggal2, kodesatker);
                        if(hasil!=null && !hasil.isEmpty()){
                            for (Lampiran1Apbd hh : hasil) {
                                if( hh.getNomor()!=null && hh.getNomor().trim().length() <4 ){
                                    hh.setStyle("font-weight: bold; ");
                                }
                            }
                        }
			return hasil;
		} catch (Exception e) {
                    e.printStackTrace();
			throw new SIKDServiceException(e.getMessage());
		}
	}
                
	public List<Lampiran1Apbd> getLaporanLraNasional(String tanggal1, String tanggal2, SqlSession session)
			throws SIKDServiceException {
		List<Lampiran1Apbd> hasil = new ArrayList();
		try {
                    LaporanMapper mapper = session.getMapper(LaporanMapper.class);
			hasil = mapper.getLaporanLraNasional(tanggal1, tanggal2);
                        if(hasil!=null && !hasil.isEmpty()){
                            for (Lampiran1Apbd hh : hasil) {
                                if( hh.getNomor()!=null && hh.getNomor().trim().length() <4 ){
                                    hh.setStyle("font-weight: bold; ");
                                }
                            }
                        }
			return hasil;
		} catch (Exception e) {
                    e.printStackTrace();
			throw new SIKDServiceException(e.getMessage());
		}
	}
        
	public List<Lampiran1Apbd> getLaporanLraPemda(String tanggal1, String tanggal2, String kodesatker, SqlSession session)
			throws SIKDServiceException {
		List<Lampiran1Apbd> hasil = new ArrayList();
		try {
			LaporanMapper mapper = session.getMapper(LaporanMapper.class);
			hasil = mapper.getLaporanLraPemda(tanggal1, tanggal2, kodesatker);
                        if(hasil!=null && !hasil.isEmpty()){
                            for (Lampiran1Apbd hh : hasil) {
                                if( hh.getNomor()!=null && hh.getNomor().trim().length() <4 ){
                                    hh.setStyle("font-weight: bold; ");
                                }
                            }
                        }
			return hasil;
		} catch (Exception e) {
                    e.printStackTrace();
			throw new SIKDServiceException(e.getMessage());
		}
	}

	public List<Lampiran1Apbd> getLaporanPostingedLoNasional(String tanggal1, String tanggal2, SqlSession session)
			throws SIKDServiceException {
		List<Lampiran1Apbd> hasil = new ArrayList();
		try {
                    LaporanMapper mapper = session.getMapper(LaporanMapper.class);
			hasil = mapper.getLaporanPostingedLoNasional(tanggal1, tanggal2);
                        if(hasil!=null && !hasil.isEmpty()){
                            for (Lampiran1Apbd hh : hasil) {
                                if( hh.getNomor()!=null && hh.getNomor().trim().length() <4 ){
                                    hh.setStyle("font-weight: bold; ");
                                }
                            }
                        }
			return hasil;
		} catch (Exception e) {
                    e.printStackTrace();
			throw new SIKDServiceException(e.getMessage());
		}
	}
        
	public List<Lampiran1Apbd> getLaporanPostingedLoPemda(String tanggal1, String tanggal2, String kodesatker, SqlSession session)
			throws SIKDServiceException {
		List<Lampiran1Apbd> hasil = new ArrayList();
		try {
			LaporanMapper mapper = session.getMapper(LaporanMapper.class);
			hasil = mapper.getLaporanPostingedLoPemda(tanggal1, tanggal2, kodesatker);
                        if(hasil!=null && !hasil.isEmpty()){
                            for (Lampiran1Apbd hh : hasil) {
                                if( hh.getNomor()!=null && hh.getNomor().trim().length() <4 ){
                                    hh.setStyle("font-weight: bold; ");
                                }
                            }
                        }
			return hasil;
		} catch (Exception e) {
                    e.printStackTrace();
			throw new SIKDServiceException(e.getMessage());
		}
	}
                
	public List<Lampiran1Apbd> getLaporanLoNasional(String tanggal1, String tanggal2, SqlSession session)
			throws SIKDServiceException {
		List<Lampiran1Apbd> hasil = new ArrayList();
		try {
                    LaporanMapper mapper = session.getMapper(LaporanMapper.class);
			hasil = mapper.getLaporanLoNasional(tanggal1, tanggal2);
                        if(hasil!=null && !hasil.isEmpty()){
                            for (Lampiran1Apbd hh : hasil) {
                                if( hh.getNomor()!=null && hh.getNomor().trim().length() <4 ){
                                    hh.setStyle("font-weight: bold; ");
                                }
                            }
                        }
			return hasil;
		} catch (Exception e) {
                    e.printStackTrace();
			throw new SIKDServiceException(e.getMessage());
		}
	}
        
	public List<Lampiran1Apbd> getLaporanLoPemda(String tanggal1, String tanggal2, String kodesatker, SqlSession session)
			throws SIKDServiceException {
		List<Lampiran1Apbd> hasil = new ArrayList();
		try {
			LaporanMapper mapper = session.getMapper(LaporanMapper.class);
			hasil = mapper.getLaporanLoPemda(tanggal1, tanggal2, kodesatker);
                        if(hasil!=null && !hasil.isEmpty()){
                            for (Lampiran1Apbd hh : hasil) {
                                if( hh.getNomor()!=null && hh.getNomor().trim().length() <4 ){
                                    hh.setStyle("font-weight: bold; ");
                                }
                            }
                        }
			return hasil;
		} catch (Exception e) {
                    e.printStackTrace();
			throw new SIKDServiceException(e.getMessage());
		}
	}


	public List<Lampiran1Apbd> getLaporanPostingedNeracaNasional(String tanggal1, String tanggal2, SqlSession session)
			throws SIKDServiceException {
		List<Lampiran1Apbd> hasil = new ArrayList();
		try {
                    LaporanMapper mapper = session.getMapper(LaporanMapper.class);
			hasil = mapper.getLaporanPostingedNeracaNasional(tanggal1, tanggal2);
                        if(hasil!=null && !hasil.isEmpty()){
                            for (Lampiran1Apbd hh : hasil) {
                                if( hh.getNomor()!=null && hh.getNomor().trim().length() <4 ){
                                    hh.setStyle("font-weight: bold; ");
                                }
                            }
                        }
			return hasil;
		} catch (Exception e) {
                    e.printStackTrace();
			throw new SIKDServiceException(e.getMessage());
		}
	}
        
	public List<Lampiran1Apbd> getLaporanPostingedNeracaPemda(String tanggal1, String tanggal2, String kodesatker, SqlSession session)
			throws SIKDServiceException {
		List<Lampiran1Apbd> hasil = new ArrayList();
		try {
			LaporanMapper mapper = session.getMapper(LaporanMapper.class);
			hasil = mapper.getLaporanPostingedNeracaPemda(tanggal1, tanggal2, kodesatker);
                        if(hasil!=null && !hasil.isEmpty()){
                            for (Lampiran1Apbd hh : hasil) {
                                if( hh.getNomor()!=null && hh.getNomor().trim().length() <4 ){
                                    hh.setStyle("font-weight: bold; ");
                                }
                            }
                        }
			return hasil;
		} catch (Exception e) {
                    e.printStackTrace();
			throw new SIKDServiceException(e.getMessage());
		}
	}
                
	public List<Lampiran1Apbd> getLaporanNeracaNasional(String tanggal1, String tanggal2, SqlSession session)
			throws SIKDServiceException {
		List<Lampiran1Apbd> hasil = new ArrayList();
		try {
                    LaporanMapper mapper = session.getMapper(LaporanMapper.class);
			hasil = mapper.getLaporanNeracaNasional(tanggal1, tanggal2);
                        if(hasil!=null && !hasil.isEmpty()){
                            for (Lampiran1Apbd hh : hasil) {
                                if( hh.getNomor()!=null && hh.getNomor().trim().length() <4 ){
                                    hh.setStyle("font-weight: bold; ");
                                }
                            }
                        }
			return hasil;
		} catch (Exception e) {
                    e.printStackTrace();
			throw new SIKDServiceException(e.getMessage());
		}
	}
        
	public List<Lampiran1Apbd> getLaporanNeracaPemda(String tanggal1, String tanggal2, String kodesatker, SqlSession session)
			throws SIKDServiceException {
		List<Lampiran1Apbd> hasil = new ArrayList();
		try {
			LaporanMapper mapper = session.getMapper(LaporanMapper.class);
			hasil = mapper.getLaporanNeracaPemda(tanggal1, tanggal2, kodesatker);
                        if(hasil!=null && !hasil.isEmpty()){
                            for (Lampiran1Apbd hh : hasil) {
                                if( hh.getNomor()!=null && hh.getNomor().trim().length() <4 ){
                                    hh.setStyle("font-weight: bold; ");
                                }
                            }
                        }
			return hasil;
		} catch (Exception e) {
                    e.printStackTrace();
			throw new SIKDServiceException(e.getMessage());
		}
	}
        
	public List<Lampiran1Apbd> getLaporanJumlahPemdaPengirim(short tahun, SqlSession session)
			throws SIKDServiceException {
		List<Lampiran1Apbd> hasil = new ArrayList();
		try {
			LaporanMapper mapper = session.getMapper(LaporanMapper.class);
			hasil = mapper.getLaporanJumlahPemdaPengirim(tahun);
			return hasil;
		} catch (Exception e) {
                    e.printStackTrace();
			throw new SIKDServiceException(e.getMessage());
		}
	}

                
}
