<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class c_template_mil_akta_banding_pidana extends CI_Controller {
	function index() {
         if($this->session->userdata('is_logged_in')==FALSE){
            redirect('login');
        }  
    }

	function popup_mil_akta_banding(){	
		if($this->session->userdata('is_logged_in')==FALSE){
            redirect('login');
        } 	
        $data['enc']=$this->uri->segment('3');
        $idperkara=$this->encrypt->decode(base64_decode($data['enc']));
		if(!is_numeric($idperkara) OR !intval($idperkara)>0){
		    show_404();
			exit();
		}
		$data['pihakasal']=$this->uri->segment('4');        
		if(!is_numeric($data['pihakasal']) OR !intval($data['pihakasal'])>0){
		    show_404();
			exit();
		}
		$data['$encpemohon']=$this->uri->segment('5');
        $idpemohon=$this->encrypt->decode(base64_decode($data['$encpemohon']));
		if(!is_numeric($idpemohon) OR !intval($idpemohon)>0){
		    show_404();
			exit();
		}
		$data['idakta'] = $this->uri->segment('6');	
			
		$this->load->model('generate_template/m_template_mil_pidana_akta_banding','template');				
		$data['listPihakBanding'] = $this->template->getDataPihakBanding($idperkara,$idpemohon);
		$data['listPihak'] = $this->template->getDataPihak($idperkara,$idpemohon);
		$data['listAllTerdakwa'] = $this->template->getDataTerdakwa($idperkara);		
		$data['listTerdakwaKontra'] = $this->template->getTerdakwaKontraMemori($idperkara);
		$data['listKuasa'] = $this->template->getDataPembanding($idperkara);
		$data['listKuasaKontra'] = $this->template->getPHKontraMemoriBanding($idperkara);
		$data['listPenuntut'] = $this->template->getDataJaksa($idperkara,$idpemohon);
		$data['listPenuntutKontra'] = $this->template->getJaksaKontraBanding($idperkara);
		$data['listPembuatAkta'] = $this->template->pembuatAkta($idperkara);	

		if($data['listPihakBanding']!=''){
			foreach ($data['listPihakBanding']->result() as $row) {
				$pihakdiwakili = $row->pihak_diwakili;
				$idpihak=$row->IDPihak;
			}
		}
		if ($data['pihakasal']==2 && $pihakdiwakili=='Y'){			
			$data['listTerdakwa'] = $this->template->infoDataTerdakwa($idperkara,$idpihak);
		}else{
			$data['listTerdakwa'] = $this->template->infoDataTerdakwa($idperkara,$idpemohon);
		}
		if($data['idakta']==1){
			foreach ($data['listPihakBanding']->result() as $row) {			
	            $data['tglpermohonan'] = $row->tglPemberitahuan;        	
	            $data['tglpermohonanindo'] = $this->templatehelper->convertKeTglIndo($row->tglPemberitahuan);
	        }
	    }elseif($data['idakta']==2){
	    	foreach ($data['listPihak']->result() as $row) {	    	
	        	$data['tglpermohonan'] = $row->tglmemori;        	
	            $data['tglpermohonanindo'] = $this->templatehelper->convertKeTglIndo($row->tglmemori);
	        }
	    }elseif($data['idakta']==3){
	    	foreach ($data['listPihak']->result() as $row) {
	        	$data['tglpermohonan'] = $row->tglkontramemori;        	
	            $data['tglpermohonanindo'] = $this->templatehelper->convertKeTglIndo($row->tglkontramemori);
	        }
	    }
        $data['template']=$this->template->getDataDocumentTemplate('120','20','290','1','');
		$this->load->view('generate_template/popup_mil_akta_pidana_banding',$data,FALSE);
	}
	function cetak_akta_banding(){
		if($this->session->userdata('is_logged_in')==FALSE){
            redirect('login');
        } 		
        $data['enc'] = $this->input->post('enc',TRUE);
        $idperkara=$this->encrypt->decode(base64_decode($data['enc']));
        if(!is_numeric($idperkara) OR !intval($idperkara)>0){
             show_404();
             exit();
        }

        $data['idterdakwa'] = $this->input->post('idterdakwa',TRUE);
	    $idterdakwa=$this->encrypt->decode(base64_decode($data['idterdakwa']));
		$data['penandatangan'] = $this->input->post('penandaT',TRUE);
        $penandatangan=$this->encrypt->decode(base64_decode($data['penandatangan']));
        $data['tglBanding'] = $this->input->post('inputpemberitahuan',TRUE);        
        $data['bandingMelalui'] = $this->input->post('bandingMelalui',TRUE);
        $data['penasihat'] = $this->input->post('idpenasihat',TRUE);
        $penasihat=$this->encrypt->decode(base64_decode($data['penasihat']));
		$data['penuntut'] = $this->input->post('idpenuntut',TRUE);
        $penuntut=$this->encrypt->decode(base64_decode($data['penuntut']));
		$data['jenisAkta'] = $this->input->post('jenisAkta',TRUE);
		if(empty($data['jenisAkta']) OR intval($data['jenisAkta'])<1){
			show_404();
		}

		$this->load->model('generate_template/m_template_mil_pidana_akta_banding','template');
		$this->load->model('generate_template/m_template_mil','template_mil');
		$data['dataTemplate2'] = $this->template_mil->getDataPutusan($idperkara);
		$data['dataPerkara'] = $this->template->getDataPerkara($idperkara);
        $data['dataPN'] = $this->template->getDataPN($idperkara);
        $data['tanggalPutus'] = $this->template->getTanggalPutusan($idperkara);        
        $data['cetakDataTerdakwa'] = $this->template->getDataTerdakwaBanding($idperkara,$idterdakwa);
        $data['cetakDataBanding'] = $this->template->getDataPembanding($idperkara);
        $data['cetakpartiesbanding'] = $this->template->getDataBandingParties($idperkara,$penasihat);
        $data['cetakDataJPU'] = $this->template->cetakDataJaksa($idperkara);
        $data['cetakDataPUKontra'] = $this->template->cetakJaksaKontra($idperkara);
        $data['oditur'] = $this->template->getoditur($idperkara); 
        $data['oditur2'] = $this->template->getoditur2($idperkara); 

		
		if($data['jenisAkta']==1){
        	$data['template']=$this->template->getDataDocumentTemplate('120','20','290','1','');
		}elseif($data['jenisAkta']==2){
        	$data['template']=$this->template->getDataDocumentTemplate('120','20','290','2','');
		}else{
			show_404();
		}
        $this->load->view('generate_template/cetak_mil_akta_pidana_banding',$data,FALSE);
	}

	function popup_mil_cabut_banding(){
		if($this->session->userdata('is_logged_in')==FALSE){
            redirect('login');
        } 
		$data['enc']=$this->uri->segment('3');
        $idperkara=$this->encrypt->decode(base64_decode($data['enc']));
		if(!is_numeric($idperkara) OR !intval($idperkara)>0){
		    show_404();
			exit();
		}
		$data['pihakasal']=$this->uri->segment('4');        
		if(!is_numeric($data['pihakasal']) OR !intval($data['pihakasal'])>0){
		    show_404();
			exit();
		}
		$data['$encpemohon']=$this->uri->segment('5');
        $idpemohon=$this->encrypt->decode(base64_decode($data['$encpemohon']));
		if(!is_numeric($idpemohon) OR !intval($idpemohon)>0){
		    show_404();
			exit();
		}

        $data['jenisAkta'] = $this->uri->segment('6');
		
		$this->load->model('generate_template/m_template_mil_pidana_akta_banding','template');
		$this->load->model('generate_template/m_template_ambil_identitas_template','template2');		
		$data['listPihakBanding'] = $this->template->getDataPihakBanding($idperkara,$idpemohon);
		$data['listPihak'] = $this->template->getDataPihak($idperkara,$idpemohon);
		$data['listAllTerdakwa'] = $this->template->getDataTerdakwa($idperkara);		
		$data['listTerdakwaKontra'] = $this->template->getTerdakwaKontraMemori($idperkara);
		$data['listKuasa'] = $this->template->getDataPembanding($idperkara);
		$data['listKuasaKontra'] = $this->template->getPHKontraMemoriBanding($idperkara);
		$data['listPenuntut'] = $this->template->getDataJaksa($idperkara,$idpemohon);
		$data['listPenuntutKontra'] = $this->template->getJaksaKontraBanding($idperkara);
		$data['listPembuatAkta'] = $this->template->pembuatAkta($idperkara);	
		if($data['listPihakBanding']!=''){
			foreach ($data['listPihakBanding']->result() as $row) {
				$pihakdiwakili = $row->pihak_diwakili;
				$idpihak=$row->IDPihak;
				$data['tglcabut'] = $row->tanggal_cabut;
				$data['tglcabutindo'] = $this->templatehelper->convertKeTglIndo($row->tanggal_cabut);
				$data['tglbanding'] = $row->permohonan_banding;
			}
		}
		if ($data['pihakasal']==2 && $pihakdiwakili=='Y'){			
			$data['listTerdakwa'] = $this->template->infoDataTerdakwa($idperkara,$idpihak);
		}else{
			$data['listTerdakwa'] = $this->template->infoDataTerdakwa($idperkara,$idpemohon);
		}

        if($data['jenisAkta']==1){
        	$data['template']=$this->template->getDataDocumentTemplate('120','20','290','3','');
		}elseif($data['jenisAkta']==2){
        	$data['template']=$this->template->getDataDocumentTemplate('120','20','290','4','');
		}else{
			show_404();
		}

		//print_r($this->template->getDataDocumentTemplate('120','16','240','13','')->result());
		//print_r($data['jenisAkta']);
		//exit();
        $this->load->view('generate_template/popup_mil_akta_pidana_pencabutan_banding',$data,FALSE);	} 	


	function popup_mil_tolak_banding(){
		if($this->session->userdata('is_logged_in')==FALSE){
            redirect('login');
        } 
		$data['enc']=$this->uri->segment('3');
        $idperkara=$this->encrypt->decode(base64_decode($data['enc']));
		if(!is_numeric($idperkara) OR !intval($idperkara)>0){
		    show_404();
			exit();
		}
		$data['pihakasal']=$this->uri->segment('4');        
		if(!is_numeric($data['pihakasal']) OR !intval($data['pihakasal'])>0){
		    show_404();
			exit();
		}
		$data['$encpemohon']=$this->uri->segment('5');
        $idpemohon=$this->encrypt->decode(base64_decode($data['$encpemohon']));
		if(!is_numeric($idpemohon) OR !intval($idpemohon)>0){
		    show_404();
			exit();
		}

        $data['jenisAkta'] = $this->uri->segment('6');
		
		$this->load->model('generate_template/m_template_mil_pidana_akta_banding','template');
		$this->load->model('generate_template/m_template_ambil_identitas_template','template2');		
		$data['listPihakBanding'] = $this->template->getDataPihakBanding($idperkara,$idpemohon);
		$data['listPihak'] = $this->template->getDataPihak($idperkara,$idpemohon);
		$data['listAllTerdakwa'] = $this->template->getDataTerdakwa($idperkara);		
		$data['listTerdakwaKontra'] = $this->template->getTerdakwaKontraMemori($idperkara);
		$data['listKuasa'] = $this->template->getDataPembanding($idperkara);
		$data['listKuasaKontra'] = $this->template->getPHKontraMemoriBanding($idperkara);
		$data['listPenuntut'] = $this->template->getDataJaksa($idperkara,$idpemohon);
		$data['listPenuntutKontra'] = $this->template->getJaksaKontraBanding($idperkara);
		$data['listPembuatAkta'] = $this->template->pembuatAkta($idperkara);	
		if($data['listPihakBanding']!=''){
			foreach ($data['listPihakBanding']->result() as $row) {
				$pihakdiwakili = $row->pihak_diwakili;
				$idpihak=$row->IDPihak;
				$data['tglcabut'] = $row->tanggal_cabut;
				$data['tglcabutindo'] = $this->templatehelper->convertKeTglIndo($row->tanggal_cabut);
				$data['tglbanding'] = $row->permohonan_banding;
			}
		}
		if ($data['pihakasal']==2 && $pihakdiwakili=='Y'){			
			$data['listTerdakwa'] = $this->template->infoDataTerdakwa($idperkara,$idpihak);
		}else{
			$data['listTerdakwa'] = $this->template->infoDataTerdakwa($idperkara,$idpemohon);
		}

        if($data['jenisAkta']==1){
        	$data['template']=$this->template->getDataDocumentTemplate('120','20','290','5','');
		}elseif($data['jenisAkta']==2){
        	$data['template']=$this->template->getDataDocumentTemplate('120','20','290','6','');
		}else{
			show_404();
		}

		//print_r($this->template->getDataDocumentTemplate('120','16','240','13','')->result());
		//print_r($data['jenisAkta']);
		//exit();
        $this->load->view('generate_template/popup_mil_akta_pidana_penolakan_banding',$data,FALSE);	} 	

    	function cetak_tolak_banding(){
		if($this->session->userdata('is_logged_in')==FALSE){
            redirect('login');
        } 
        $data['enc'] = $this->input->post('enc',TRUE);
        $idperkara=$this->encrypt->decode(base64_decode($data['enc']));
        if(!is_numeric($idperkara) OR !intval($idperkara)>0){
             show_404();
             exit();
        }
        $data['idterdakwa'] = $this->input->post('idterdakwa',TRUE);
	    $idterdakwa=$this->encrypt->decode(base64_decode($data['idterdakwa']));
	    $data['penandatangan'] = $this->input->post('penandaT',TRUE);
        $penandatangan=$this->encrypt->decode(base64_decode($data['penandatangan']));						
		$data['bandingMelalui'] = $this->input->post('bandingMelalui',TRUE);
        $data['penasihat'] = $this->input->post('idpenasihat',TRUE);
        $penasihat=$this->encrypt->decode(base64_decode($data['penasihat']));
		$data['penuntut'] = $this->input->post('idpenuntut',TRUE);
        $penuntut=$this->encrypt->decode(base64_decode($data['penuntut']));
		$data['jenisAkta'] = $this->input->post('jenisAkta',TRUE);
		if(empty($data['jenisAkta']) OR intval($data['jenisAkta'])<1){
			show_404();
		} 
		$data['tglcabut'] = $this->input->post('tgl_cabut',TRUE);
		$data['tglBanding'] = $this->input->post('tglbanding');
		
		$this->load->model('generate_template/m_template_mil_pidana_akta_banding','template');	
		$this->load->model('generate_template/m_template_mil','template_mil');
		$data['dataTemplate2'] = $this->template_mil->getDataPutusan($idperkara);	
		$data['dataPerkara'] = $this->template->getDataPerkara($idperkara);
        $data['dataPN'] = $this->template->getDataPN($idperkara);
        $data['tanggalPutus'] = $this->template->getTanggalPutusan($idperkara);        
        $data['cetakDataTerdakwa'] = $this->template->getDataTerdakwaBanding($idperkara,$idterdakwa);
        $data['cetakDataBanding'] = $this->template->getDataPembanding($idperkara);
        $data['cetakpartiesbanding'] = $this->template->getDataBandingParties($idperkara,$penasihat);
        $data['cetakDataJPU'] = $this->template->cetakDataJaksa($idperkara);
		$data['cetakTanggalCabut'] = $this->template->getTanggalCabutBanding($idperkara);    
		$data['oditur'] = $this->template->getoditur($idperkara); 
        $data['oditur2'] = $this->template->getoditur2($idperkara); 
    	
		
		if($data['jenisAkta']==1){
			$data['template']=$this->template->getDataDocumentTemplate('120','20','290','5','');
		}elseif($data['jenisAkta']==2){
			$data['template']=$this->template->getDataDocumentTemplate('120','20','290','6','');
		}elseif($data['jenisAkta']==3){
		    $data['template']=$this->template->getDataDocumentTemplate('111','20','290','607','');
		}elseif($data['jenisAkta']==4){
		    $data['template']=$this->template->getDataDocumentTemplate('111','20','290','608','');
		}else{
			show_404();
		}

        //echo $data['jenisAkta'];
        //exit();
		$this->load->view('generate_template/cetak_mil_akta_pidana_penolakan_banding',$data,FALSE);
	} 

    	function cetak_cabut_banding(){
		if($this->session->userdata('is_logged_in')==FALSE){
            redirect('login');
        } 
        $data['enc'] = $this->input->post('enc',TRUE);
        $idperkara=$this->encrypt->decode(base64_decode($data['enc']));
        if(!is_numeric($idperkara) OR !intval($idperkara)>0){
             show_404();
             exit();
        }
        $data['idterdakwa'] = $this->input->post('idterdakwa',TRUE);
	    $idterdakwa=$this->encrypt->decode(base64_decode($data['idterdakwa']));
	    $data['penandatangan'] = $this->input->post('penandaT',TRUE);
        $penandatangan=$this->encrypt->decode(base64_decode($data['penandatangan']));						
		$data['bandingMelalui'] = $this->input->post('bandingMelalui',TRUE);
        $data['penasihat'] = $this->input->post('idpenasihat',TRUE);
        $penasihat=$this->encrypt->decode(base64_decode($data['penasihat']));
		$data['penuntut'] = $this->input->post('idpenuntut',TRUE);
        $penuntut=$this->encrypt->decode(base64_decode($data['penuntut']));
		$data['jenisAkta'] = $this->input->post('jenisAkta',TRUE);
		if(empty($data['jenisAkta']) OR intval($data['jenisAkta'])<1){
			show_404();
		} 
		$data['tglcabut'] = $this->input->post('tglcabut',TRUE);
		$data['tglBanding'] = $this->input->post('tglbanding');
		
		$this->load->model('generate_template/m_template_mil_pidana_akta_banding','template');	
		$this->load->model('generate_template/m_template_mil','template_mil');
		$data['dataTemplate2'] = $this->template_mil->getDataPutusan($idperkara);	
		$data['dataPerkara'] = $this->template->getDataPerkara($idperkara);
        $data['dataPN'] = $this->template->getDataPN($idperkara);
        $data['tanggalPutus'] = $this->template->getTanggalPutusan($idperkara);        
        $data['cetakDataTerdakwa'] = $this->template->getDataTerdakwaBanding($idperkara,$idterdakwa);
        $data['cetakDataBanding'] = $this->template->getDataPembanding($idperkara);
        $data['cetakpartiesbanding'] = $this->template->getDataBandingParties($idperkara,$penasihat);
        $data['cetakDataJPU'] = $this->template->cetakDataJaksa($idperkara);
		$data['cetakTanggalCabut'] = $this->template->getTanggalCabutBanding($idperkara); 
        $data['oditur'] = $this->template->getoditur($idperkara); 
        $data['oditur2'] = $this->template->getoditur2($idperkara); 
        $data['biaya_banding'] = $this->template->biaya_tk_banding($idperkara);

		if($data['jenisAkta']==1){
			$data['template']=$this->template->getDataDocumentTemplate('120','20','290','3','');
		}elseif($data['jenisAkta']==2){
			$data['template']=$this->template->getDataDocumentTemplate('120','20','290','4','');
		}elseif($data['jenisAkta']==3){
		    $data['template']=$this->template->getDataDocumentTemplate('111','20','290','607','');
		}elseif($data['jenisAkta']==4){
		    $data['template']=$this->template->getDataDocumentTemplate('111','20','290','608','');
		}else{
			show_404();
		}

		$this->load->view('generate_template/cetak_mil_akta_pidana_pencabutan_banding',$data,FALSE);
	} 

	function popup_mil_relaas_banding(){
		if($this->session->userdata('is_logged_in')==FALSE){
            redirect('login');
        } 
        $data['enc']=$this->uri->segment('3');
        $idperkara=$this->encrypt->decode(base64_decode($data['enc']));
		if(!is_numeric($idperkara) OR !intval($idperkara)>0){
		    show_404();
			exit();
		}
		$data['pihakasal']=$this->uri->segment('4');  
		if(!is_numeric($data['pihakasal']) OR !intval($data['pihakasal'])>0){
		    show_404();
			exit();
		}
		$data['$encpihak']=$this->uri->segment('5');
        $idpihak=$this->encrypt->decode(base64_decode($data['$encpihak']));
		if(!is_numeric($idpihak) OR !intval($idpihak)>0){
		    show_404();
			exit();
		}
		
		$data['jenisrelas']=$this->uri->segment('6');
		$this->load->model('generate_template/m_template_mil_pidana_akta_banding','template');
		//$data['listPihakBanding'] = $this->template->getDataPihakBanding($idperkara,$idpihak);
		$data['listTerdakwa'] = $this->template->getDataTerdakwa($idperkara);
		$data['relaasTerdakwa'] = $this->template->infoDataTerdakwa($idperkara,$idpihak);		
		$data['listKuasa'] = $this->template->getDataPembanding($idperkara);
		$data['listPenuntut'] = $this->template->getInfoPihak($idperkara,$idpihak);		
		$data['listPembuatAkta'] = $this->template->pembuatAkta($idperkara);
		$data['listPembanding'] = $this->template->getPihakPembanding($idperkara);
		$data['listTerbanding'] = $this->template->getPihakTerbanding($idperkara);
		$data['infotglpemberitahuan'] = $this->template->getTanggalPemberitahuanBanding($idperkara,$idpihak);
		//print_r($data['infotglpemberitahuan']->result());exit();
		foreach ($data['infotglpemberitahuan']->result() as $row) {
			if($data['jenisrelas']==1){
				$data['tglpemberitahuan'] = $row->pemberitahuan;
				$data['tglpemberitahuanindo'] = $this->templatehelper->convertKeTglIndo($row->pemberitahuan);       	
			}else
			if($data['jenisrelas']==2){
				$data['tglpemberitahuan'] = $row->penerimaan_memori_banding;
				$data['tglpemberitahuanindo'] = $this->templatehelper->convertKeTglIndo($row->penerimaan_memori_banding);       	
			}else
			if($data['jenisrelas']==3){
				$data['tglpemberitahuan'] = $row->penyerahan_memori_banding;
				$data['tglpemberitahuanindo'] = $this->templatehelper->convertKeTglIndo($row->penyerahan_memori_banding);       	
			}else
			if($data['jenisrelas']==4){
				$data['tglpemberitahuan'] = $row->penerimaan_kontra_banding;
				$data['tglpemberitahuanindo'] = $this->templatehelper->convertKeTglIndo($row->penerimaan_kontra_banding);       	
			}else
			if($data['jenisrelas']==5){
				$data['tglpemberitahuan'] = $row->penyerahan_kontra_banding;
				$data['tglpemberitahuanindo'] = $this->templatehelper->convertKeTglIndo($row->penyerahan_kontra_banding);       	
			}else
			if($data['jenisrelas']==6){
				$data['tglpemberitahuan'] = $row->pemberitahuan_inzage;
				$data['tglpemberitahuanindo'] = $this->templatehelper->convertKeTglIndo($row->pemberitahuan_inzage);       	
			}else
			if($data['jenisrelas']==7){
				$data['tglpemberitahuan'] = $row->pemberitahuan_putusan_banding;
				$data['tglpemberitahuanindo'] = $this->templatehelper->convertKeTglIndo($row->pemberitahuan_putusan_banding);       	
			}
		}

		
        $data['judul']='';
        $data['jnsperkara']='';
        $idalurperkara = $this->tanggalhelper->getIDAlurPerkara($idperkara);
        //$data['jnsperkara'] = "PIDANA MILITER";
        
		$this->load->view('generate_template/popup_mil_relaas_pidana_banding',$data,FALSE);
	}


 function popup_mil_pemberitahuan_cabut_banding(){	
		if($this->session->userdata('is_logged_in')==FALSE){
            redirect('login');
        } 	
        $data['enc']=$this->uri->segment('3');
        $idperkara=$this->encrypt->decode(base64_decode($data['enc']));
		if(!is_numeric($idperkara) OR !intval($idperkara)>0){
		    show_404();
			exit();
		}
		$data['pihakasal']=$this->uri->segment('4');        
		if(!is_numeric($data['pihakasal']) OR !intval($data['pihakasal'])>0){
		    show_404();
			exit();
		}
		$data['$encpemohon']=$this->uri->segment('5');
        $idpemohon=$this->encrypt->decode(base64_decode($data['$encpemohon']));
		if(!is_numeric($idpemohon) OR !intval($idpemohon)>0){
		    show_404();
			exit();
		}
		//$data['idakta'] = $this->uri->segment('6');		
        $data['jenisAkta'] = $this->uri->segment('6');

		$this->load->model('generate_template/m_template_mil_pidana_akta_banding','template');
        $this->load->model('generate_template/m_template_ambil_identitas_template','template2');

		$data['listPihakBanding'] = $this->template->getDataPihakBanding($idperkara,$idpemohon);
		$data['listPihak'] = $this->template->getDataPihak($idperkara,$idpemohon);
		$data['listAllTerdakwa'] = $this->template->getDataTerdakwa($idperkara);		
		$data['listTerdakwaKontra'] = $this->template->getTerdakwaKontraMemori($idperkara);
		$data['listKuasa'] = $this->template->getDataPembanding($idperkara);
		$data['listKuasaKontra'] = $this->template->getPHKontraMemoriBanding($idperkara);
		$data['listPenuntut'] = $this->template->getDataJaksa($idperkara,$idpemohon);
		$data['listPenuntutKontra'] = $this->template->getJaksaKontraBanding($idperkara);
		$data['listPembuatAkta'] = $this->template->pembuatAkta($idperkara);	

		if($data['listPihakBanding']!=''){
			foreach ($data['listPihakBanding']->result() as $row) {
				$pihakdiwakili = $row->pihak_diwakili;
				$idpihak=$row->IDPihak;
				$data['tglcabut'] = $row->tanggal_cabut;
				$data['tglcabutindo'] = $this->templatehelper->convertKeTglIndo($row->tanggal_cabut);
				$data['tglbanding'] = $row->permohonan_banding;
			}
		}
		if ($data['pihakasal']==2 && $pihakdiwakili=='Y'){			
			$data['listTerdakwa'] = $this->template->infoDataTerdakwa($idperkara,$idpihak);
		}else{
			$data['listTerdakwa'] = $this->template->infoDataTerdakwa($idperkara,$idpemohon);
		}

		        if($data['jenisAkta']==1){
        	$data['template']=$this->template->getDataDocumentTemplate('120','20','300','4','');
		}elseif($data['jenisAkta']==2){
        	$data['template']=$this->template->getDataDocumentTemplate('120','20','300','3','');
		}else{
			show_404();
		}

		// if($data['idakta']==1){
		//	foreach ($data['listPihakBanding']->result() as $row) {			
	    //        $data['tglpermohonan'] = $row->tglPemberitahuan;        	
	    //        $data['tglpermohonanindo'] = $this->templatehelper->convertKeTglIndo($row->tglPemberitahuan);
	    //    }
	    // }elseif($data['idakta']==2){
	    //	foreach ($data['listPihak']->result() as $row) {	    	
	    //    	$data['tglpermohonan'] = $row->tglmemori;        	
	    //        $data['tglpermohonanindo'] = $this->templatehelper->convertKeTglIndo($row->tglmemori);
	    //    }
	    // }elseif($data['idakta']==3){
	    //	foreach ($data['listPihak']->result() as $row) {
	    //    	$data['tglpermohonan'] = $row->tglkontramemori;        	
	    //        $data['tglpermohonanindo'] = $this->templatehelper->convertKeTglIndo($row->tglkontramemori);
	    //    }
	    // }
	    
        //$data['template']=$this->template->getDataDocumentTemplate('120','16','240','12','permohonan banding');
		$this->load->view('generate_template/popup_mil_akta_pidana_pemberitahuan_pencabutan_banding',$data,FALSE);
	}


	function cetak_pemberitahuan_cabut_banding(){
		if($this->session->userdata('is_logged_in')==FALSE){
            redirect('login');
        } 
        $data['enc'] = $this->input->post('enc',TRUE);
        $idperkara=$this->encrypt->decode(base64_decode($data['enc']));
        if(!is_numeric($idperkara) OR !intval($idperkara)>0){
             show_404();
             exit();
        }
        $data['idterdakwa'] = $this->input->post('idterdakwa',TRUE);
	    $idterdakwa=$this->encrypt->decode(base64_decode($data['idterdakwa']));
	    $data['penandatangan'] = $this->input->post('penandaT',TRUE);
        $penandatangan=$this->encrypt->decode(base64_decode($data['penandatangan']));						
		$data['bandingMelalui'] = $this->input->post('bandingMelalui',TRUE);
        $data['penasihat'] = $this->input->post('idpenasihat',TRUE);
        $penasihat=$this->encrypt->decode(base64_decode($data['penasihat']));
		$data['penuntut'] = $this->input->post('idpenuntut',TRUE);
        $penuntut=$this->encrypt->decode(base64_decode($data['penuntut']));
		$data['jenisAkta'] = $this->input->post('jenisAkta',TRUE);
		if(empty($data['jenisAkta']) OR intval($data['jenisAkta'])<1){
			show_404();
		} 
		$data['tglcabut'] = $this->input->post('tgl_cabut',TRUE);
		$data['tglBanding'] = $this->input->post('tglbanding');
		
		$this->load->model('generate_template/m_template_mil_pidana_akta_banding','template');	
		$this->load->model('generate_template/m_template_mil','template_mil');
		$data['dataTemplate2'] = $this->template_mil->getDataPutusan($idperkara);	
		$data['dataPerkara'] = $this->template->getDataPerkara($idperkara);
        $data['dataPN'] = $this->template->getDataPN($idperkara);
        $data['tanggalPutus'] = $this->template->getTanggalPutusan($idperkara);        
        $data['cetakDataTerdakwa'] = $this->template->getDataTerdakwaBanding($idperkara,$idterdakwa);
        $data['cetakDataBanding'] = $this->template->getDataPembanding($idperkara);
        $data['cetakpartiesbanding'] = $this->template->getDataBandingParties($idperkara,$penasihat);
        $data['cetakDataJPU'] = $this->template->cetakDataJaksa($idperkara);
		$data['cetakTanggalCabut'] = $this->template->getTanggalCabutBanding($idperkara); 
        $data['oditur'] = $this->template->getoditur($idperkara); 
        $data['oditur2'] = $this->template->getoditur2($idperkara); 
        $data['biaya_banding'] = $this->template->biaya_tk_banding($idperkara); 

		if($data['jenisAkta']==1){
			$data['template']=$this->template->getDataDocumentTemplate('120','20','300','4','');
		}elseif($data['jenisAkta']==2){
			$data['template']=$this->template->getDataDocumentTemplate('120','20','300','3','');
		}elseif($data['jenisAkta']==3){
		    $data['template']=$this->template->getDataDocumentTemplate('111','20','290','607','');
		}elseif($data['jenisAkta']==4){
		    $data['template']=$this->template->getDataDocumentTemplate('111','20','290','608','');
		}else{
			show_404();
		}

		$this->load->view('generate_template/cetak_mil_akta_pidana_pemberitahuan_pencabutan_banding',$data,FALSE);
	} 

	function cetak_relaas_banding(){
		if($this->session->userdata('is_logged_in')==FALSE){
            redirect('login');
        } 
		$data['enc'] = $this->input->post('enc',TRUE);
        $idperkara=$this->encrypt->decode(base64_decode($data['enc']));
        if(!is_numeric($idperkara) OR !intval($idperkara)>0){
             show_404();
             exit();
        }

		$data['idterdakwa'] = $this->input->post('terdakwa',TRUE);
	    $idterdakwa=$this->encrypt->decode(base64_decode($data['idterdakwa']));		


		$data['idpenuntut'] = $this->input->post('idpenuntut',TRUE);
	    $idpenuntut=$this->encrypt->decode(base64_decode($data['idpenuntut']));		

		$data['jenisAkta'] = $this->input->post('jenisAkta',TRUE);
		if(empty($data['jenisAkta']) OR intval($data['jenisAkta'])<1){
			show_404();
			exit();
		}
		
		$data['pembanding'] = $this->input->post('pembanding',TRUE);
        $pembanding=$this->encrypt->decode(base64_decode($data['pembanding']));

		$data['terbanding'] = $this->input->post('terbanding',TRUE);
        $terbanding=$this->encrypt->decode(base64_decode($data['terbanding']));

       	$data['tglpenyerahan'] = $this->input->post('tglpemberitahuan',TRUE);
       	$data['tglpenerimaan'] = $this->input->post('inputpenerimaankontra1',TRUE);       
        
		$data['tglpemberitahuan'] = $this->input->post('tglpemberitahuan',TRUE);
 
		$this->load->model('generate_template/m_template_mil_pidana_akta_banding','template');
		$this->load->model('generate_template/m_template_ambil_identitas_template','template2');		
		//$this->load->model('generate_template/m_template_mil','template_mil'); 
	    $data['dataTemplate2'] = $this->template->getDataPutusan($idperkara);
	    $data['cetakDataBanding'] = $this->template->getDataPembanding($idperkara);
    	$data['cetakTanggalCabut'] = $this->template->getTanggalCabutBanding($idperkara);
		$data['dataPerkara'] = $this->template->getDataPerkara($idperkara);
        $data['dataPN'] = $this->template->getDataPN($idperkara);
        $data['tanggalPutus'] = $this->template->getTanggalPutusan($idperkara);
		$data['tanggalPemberitahuan'] = $this->template->getTanggalPemberitahuanBanding($idperkara,$idterdakwa);
		//$data['cetakJurusita'] = $this->template->cetakJurusita($idjurusita);
		$data['cetakDataJPU'] = $this->template->cetakPemberitahuanPU($idperkara);
        $data['cetakpartiesbanding'] = $this->template->getDataBandingParties2($idperkara);
  
        $data['cetakDataTerdakwa'] = $this->template->getDataTerdakwaBanding($idperkara,$idterdakwa); 
        $data['cetakDataTerdakwa2'] = $this->template->getDataTerdakwaBanding2($idperkara,$idterdakwa); 


		$data['cetakPartiesJaksa'] = $this->template->cetakJaksaParties($idperkara);		
		$data['cetaktanggalPemberitahuan'] = $this->template->cetakPemberitahuanBandingPU($idperkara);
		$data['cetakTanggalMemori'] = $this->template->getTanggalPemberitahuanBanding($idperkara, $idterdakwa);
		$data['cetakTglTerdakwaPembanding'] = $this->template->getTanggalPemberitahuanBanding($idperkara, $idterdakwa);
		
		$data['cetakTglRelaasPU'] = $this->template->getTanggalPemberitahuanBanding($idperkara, $idpenuntut);
		$data['infoOditur'] = $this->template->getDataOditur($idperkara);
		// print_r($data['cetakTglRelaasPU']);
		//exit();
		$data['cetakPUBanding'] = $this->template->getJaksaBanding($idperkara,$idpenuntut);
		$data['cetakBandingPT'] = $this->template->getDataBandingPT($idperkara); 
		$data['cetakAllTerdakwa'] = $this->template->getAllTerdakwa($idperkara);       	
		$data['cetakAllPembanding'] = $this->template->getAllPihakBanding($idperkara,$pembanding);
		$data['cetakAllTerbanding'] = $this->template->getAllPihakBanding($idperkara,$terbanding);
		$data['infotglbandingterdakwa'] = $this->template->infoTglBanding($idperkara);		
        $data['oditur'] = $this->template->getoditur($idperkara); 
        $data['oditur2'] = $this->template->getoditur2($idperkara); 

        //print_r($data['dataTemplate2']->result());
        //exit();
     
		if($data['jenisAkta']==1){
	        $data['template']=$this->template2->getDataDocumentTemplate('120','20','300','1','');
		}elseif($data['jenisAkta']==2){
	        $data['template']=$this->template2->getDataDocumentTemplate('120','20','300','2','');
		}elseif($data['jenisAkta']==3){
	        $data['template']=$this->template2->getDataDocumentTemplate('120','20','350','2','');
		}elseif($data['jenisAkta']==4){
	        $data['template']=$this->template2->getDataDocumentTemplate('120','20','350','1','');
		}elseif($data['jenisAkta']==5){
	        $data['template']=$this->template2->getDataDocumentTemplate('120','20','400','1','');
		}elseif($data['jenisAkta']==6){
	        $data['template']=$this->template2->getDataDocumentTemplate('120','20','400','2','');
		}elseif($data['jenisAkta']==7){
	        $data['template']=$this->template2->getDataDocumentTemplate('120','20','310','2','');
		}elseif($data['jenisAkta']==8){
	        $data['template']=$this->template2->getDataDocumentTemplate('120','20','310','1','');
		}elseif($data['jenisAkta']==9){
	        $data['template']=$this->template2->getDataDocumentTemplate('120','20','320','2','');
		}elseif($data['jenisAkta']==10){
	        $data['template']=$this->template2->getDataDocumentTemplate('120','20','320','1','');
		}elseif($data['jenisAkta']==11){
	        $data['template']=$this->template2->getDataDocumentTemplate('120','20','330','2','');
		}elseif($data['jenisAkta']==12){
	        $data['template']=$this->template2->getDataDocumentTemplate('120','20','330','1','');
		}elseif($data['jenisAkta']==13){
	        $data['template']=$this->template2->getDataDocumentTemplate('120','20','340','2','');
		}elseif($data['jenisAkta']==14){
	        $data['template']=$this->template2->getDataDocumentTemplate('120','20','340','1','');
		}else{
			show_404();
		}

		$this->load->view('generate_template/cetak_mil_relaas_pidana_banding',$data,FALSE);
	} 

}