Package entity

Examples of entity.HistoryCuti


        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();
        try {
            EntityManagerFactory emf = Persistence.createEntityManagerFactory("SisInfPengambilanCutiPU");
            EntityManager em = emf.createEntityManager();
            HistoryCuti hc = new HistoryCuti();
            HistoryCutiDAO hdao = new HistoryCutiDAOImpl(em);
            String usrname = request.getParameter("usrname");
            Karyawan k = new Karyawan();
            k.setId(Long.parseLong(usrname));
            List<HistoryCuti> dataHC = hdao.getByIdKaryawan(k);
            boolean cekPending = false;
            for (int i = 0; i < dataHC.size(); i++) {
                if (dataHC.get(i).getStatus().equalsIgnoreCase("Pending")) {
                    cekPending = true;
                    break;
                }
            }
            if (!cekPending) {
                KaryawanDAO kdao = new KaryawanDAOImpl(em);
                try {
                    k = kdao.get(Long.parseLong(usrname));
                } catch (Exception ex) {
                    Logger.getLogger(RequestCuti.class.getName()).log(Level.SEVERE, null, ex);
                }
                String alasan = request.getParameter("alasancuti");
                String status = "pending";
                String tgl1 = request.getParameter("cmbTanggal1");
                String bln1 = request.getParameter("cmbBulan1");
                String thn1 = request.getParameter("cmbTahun1");
                String tgl2 = request.getParameter("cmbTanggal2");
                String bln2 = request.getParameter("cmbBulan2");
                String thn2 = request.getParameter("cmbTahun2");
               
               
                String convertBulan1 = "";
                String convertBulan2 = "";
                String[] hurufBulan = {"januari", "februari", "maret", "april", "mei", "juni", "juli", "agustus", "september", "oktober", "november", "desember"};
                int a = 0;
                for (int i = 0; i < hurufBulan.length; i++) {
                    a = i + 1;
                    if (hurufBulan[i].contains(bln1)) {
                        if (i == 9 || i == 10 || i == 11) {
                            convertBulan1 = "" + a;
                        } else {
                            convertBulan1 = "0" + a;
                        }
                    }
                    if (hurufBulan[i].contains(bln2)) {
                        if (i == 9 || i == 10 || i == 11) {
                            convertBulan2 = "" + a;
                        } else {
                            convertBulan2 = "0" + a;
                        }
                    }
                }
               
               
                String tanggalAwal = tgl1 + "-" + convertBulan1 + "-" + thn1;
                String tanggalAkhir = tgl2 + "-" + convertBulan2 + "-" + thn2;


                hc.setAlasan(alasan);
                hc.setStatus(status);
                hc.setTglakhircuti(tanggalAkhir);
                hc.setTglawalcuti(tanggalAwal);
                hc.setKaryawan(k);
                try {
                    if (Integer.parseInt(k.getSisacuti()) > 0) {
                        hdao.insert(hc);
                        kdao.updateNotifikasi(k.getId().toString(), "true");
                        response.sendRedirect("/SisInfPengambilanCuti/home.jsp");
View Full Code Here

TOP

Related Classes of entity.HistoryCuti

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.