<?php
 session_cache_expire(1440);
session_start();
session_name("insys");
include "include/config.php";
include "include/functions.php";
//include "class/template_class.php";
include "include/report_generator.php";
//foreach ($_REQUEST as $key1 => $value1) {
//  $_REQUEST[$key1]=str_replace('_|_','/',$_REQUEST[$key1]);
//}

$dir="report/hrd/report/";
$paramsx=array();

$ssql="select * from tlreport where fnid='{$_REQUEST['id']}'";
$rs=mysql_query($ssql);
$r=mysql_fetch_assoc($rs);
$code=$r['ftreport_code'];
//$code=$_REQUEST['code'];


switch ($code) {
    case "h001":
             $paramsx[]=array("name"=>"pfnsni",
                          "value"=>$_REQUEST['pfnsni'],
                          "type"=>"string");
           $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");
         
        show_report($dir."report01_employee",$paramsx);
    break;
    case "h001_1":
           $paramsx[]=array("name"=>"pfnsni",
                          "value"=>$_REQUEST['pfnsni'],
                          "type"=>"string");
           $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");
        show_report($dir."report01_employee_keluar",$paramsx);
    break;
    case "h002":

           $paramsx[]=array("name"=>"pfnsni",
                          "value"=>$_REQUEST['pfnsni'],
                          "type"=>"string");
           $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");
		#pr($paramsx);
        show_report($dir."report02_rekap_jml_harian_karya",$paramsx);
    break;
     case "h002_1":
              $paramsx[]=array("name"=>"pfnsni",
                          "value"=>$_REQUEST['pfnsni'],
                          "type"=>"string");
            $paramsx[]=array("name"=>"pdate",
                          "value"=>Cdate($_REQUEST['pdate'])." 00:00:00",
                          "type"=>"date");
           $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");
		#pr($paramsx);
        show_report($dir."report02_rekap_jml_harian_karya_masuk",$paramsx);
    break;
     case "h002_3":
           $paramsx[]=array("name"=>"pfnsni",
                          "value"=>$_REQUEST['pfnsni'],
                          "type"=>"string");
            $paramsx[]=array("name"=>"pdate",
                          "value"=>Cdate($_REQUEST['pdate'])." 00:00:00",
                          "type"=>"date");
           $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");
		#pr($paramsx);
        show_report($dir."report02_rekap_jml_harian_karya_keluar",$paramsx);
    break;
    case "h003":
			
           $paramsx[]=array("name"=>"pfnsni",
                          "value"=>$_REQUEST['pfnsni'],
                          "type"=>"string");
           $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");
        show_report($dir."report03_rekap_jml_karya",$paramsx);
    break;
   
    case "h004":
           $paramsx[]=array("name"=>"date_from",
                          "value"=>Cdate($_REQUEST['pdate'])." 00:00:00",
                          "type"=>"date");
           $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");
                        
           if($_REQUEST['ftdivision_code']=="SELURUH") {
               $ftdivision_code="%%";
           }
           else {
               $ftdivision_code=$_REQUEST['ftdivision_code'];
           }
           
           $paramsx[]=array("name"=>"ftdivision_code",
                          "value"=>$ftdivision_code,
                          "type"=>"string");
		#pr($paramsx);
        show_report($dir."report04_jamsostek2",$paramsx);
    break;
     case "h004_1":
           $paramsx[]=array("name"=>"date_from",
                          "value"=>Cdate($_REQUEST['pdate'])." 00:00:00",
                          "type"=>"date");
           $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");

           if($_REQUEST['ftdepartment_code']=="SELURUH") {
               $ftdepartment_code="%%";
           }
           else {
               $ftdepartment_code=$_REQUEST['ftdepartment_code'];
           }

           $paramsx[]=array("name"=>"ftdepartment_code",
                          "value"=>$ftdepartment_code,
                          "type"=>"string");
		#pr($paramsx);
        show_report($dir."report04_jamsostek3",$paramsx);
    break;
    case "h005":
         $paramsx[]=array("name"=>"date_from",
                          "value"=>Cdate($_REQUEST['pdate'])." 00:00:00",
                          "type"=>"date");
           $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");
		#pr($paramsx);
        show_report($dir."report05_karyawan_dpt_uang_makan",$paramsx);
    break;
      case "h008":
           $paramsx[]=array("name"=>"date_from",
                          "value"=>Cdate($_REQUEST['pdate_from'])." 00:00:00",
                          "type"=>"date");
          $paramsx[]=array("name"=>"date_end",
                          "value"=>Cdate($_REQUEST['pdate_end'])." 00:00:00",
                          "type"=>"date");
           $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");
		#pr($paramsx);
//        show_report($dir."report08_gaji_karyawan_lembur",$paramsx);
    break;
      case "h009":
           $paramsx[]=array("name"=>"date_from",
                          "value"=>Cdate($_REQUEST['pdate_from'])." 00:00:00",
                          "type"=>"date");
          $paramsx[]=array("name"=>"date_end",
                          "value"=>Cdate($_REQUEST['pdate_end'])." 00:00:00",
                          "type"=>"date");
           $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");
		#pr($paramsx);
//        show_report($dir."report09_rekap_gaji_harian",$paramsx);
    break;
     case "h010":

           $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");
		#pr($paramsx);
        show_report($dir."report10_kartu_absensi",$paramsx);
    break;
       case "h011":
//           $paramsx[]=array("name"=>"date_from",
//                          "value"=>Cdate($_REQUEST['pdate_from'])." 00:00:00",
//                          "type"=>"date");
//          $paramsx[]=array("name"=>"date_end",
//                          "value"=>Cdate($_REQUEST['pdate_end'])." 00:00:00",
//                          "type"=>"date");
//           $paramsx[]=array("name"=>"username",
//                          "value"=>$_SESSION['username'],
//                          "type"=>"string");
            if($_REQUEST['ftdivision_code']=='SELURUH') {
                $_REQUEST['ftdivision_code']="%%";
            }
             if($_REQUEST['ftdepartment_code']=='SELURUH') {
                $_REQUEST['ftdepartment_code']="%%";
            }
             if($_REQUEST['ftposition_code']=='SELURUH') {
                $_REQUEST['ftposition_code']="%%";
            }
              if($_REQUEST['ftgroup_pengajian_code']=='SELURUH') {
                $_REQUEST['ftgroup_pengajian_code']="%%";
            }

             $paramsx[]=array("name"=>"ftdivision_name",
                          "value"=>base64_decode($_REQUEST['hidden_ftdivision_code']),
                          "type"=>"string");
             $paramsx[]=array("name"=>"ftdepartment_name",
                          "value"=>base64_decode($_REQUEST['hidden_ftdepartment_code']),
                          "type"=>"string");
             $paramsx[]=array("name"=>"ftposition_name",
                          "value"=>base64_decode($_REQUEST['hidden_ftposition_code']),
                          "type"=>"string");
             $paramsx[]=array("name"=>"ftgroup_pengajian_name",
                          "value"=>base64_decode($_REQUEST['hidden_ftgroup_pengajian_code']),
                          "type"=>"string");

             $paramsx[]=array("name"=>"ftdivision_code",
                          "value"=>$_REQUEST['ftdivision_code'],
                          "type"=>"string");
             $paramsx[]=array("name"=>"ftdepartment_code",
                          "value"=>$_REQUEST['ftdepartment_code'],
                          "type"=>"string");
             $paramsx[]=array("name"=>"ftposition_code",
                          "value"=>$_REQUEST['ftposition_code'],
                          "type"=>"string");
             $paramsx[]=array("name"=>"ftgroup_pengajian_code",
                          "value"=>$_REQUEST['ftgroup_pengajian_code'],
                          "type"=>"string");

             $paramsx[]=array("name"=>"date_from",
                          "value"=>Cdate($_REQUEST['pdate_from'])." 00:00:00",
                          "type"=>"date");
             $paramsx[]=array("name"=>"date_end",
                          "value"=>Cdate($_REQUEST['pdate_end'])." 00:00:00",
                          "type"=>"date");
             $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");
        show_report($dir."report11_rekap_absensi3",$paramsx);
    break;
       case "h012":
         if($_REQUEST['pftemployee_code']=="SELURUH") {
                $_REQUEST['pftemployee_code']="%%"; 
         }
         if($_REQUEST['pftbankpym_no']=="SELURUH") {
                $_REQUEST['pftbankpym_no']="%%";
         }
         if($_REQUEST['pLunas']=="SELURUH") {
                $_REQUEST['pLunas']="0|1|2|3";
         }
         elseif($_REQUEST['pLunas']=="0") {
                $_REQUEST['pLunas']="0|1|2";
         }
         elseif($_REQUEST['pLunas']=="1") {
                $_REQUEST['pLunas']="3";
         }
         
          $paramsx[]=array("name"=>"pftemployee_code",
                          "value"=>$_REQUEST['pftemployee_code'],
                          "type"=>"string");
            $paramsx[]=array("name"=>"pftbankpym_no",
                  "value"=>$_REQUEST['pftbankpym_no'],
                  "type"=>"string");
            $paramsx[]=array("name"=>"pLunas",
                  "value"=>$_REQUEST['pLunas'],
                  "type"=>"string");
                      
           $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");
//		pr($paramsx);
        show_report($dir."report12_pinjaman",$paramsx);
    break;
     case "h013":
            if($_REQUEST['ftdivision_code']=='SELURUH') {
                $_REQUEST['ftdivision_code']="%%";
            }
             if($_REQUEST['ftdepartment_code']=='SELURUH') {
                $_REQUEST['ftdepartment_code']="%%";
            }
             if($_REQUEST['ftposition_code']=='SELURUH') {
                $_REQUEST['ftposition_code']="%%";
            }
              if($_REQUEST['ftgroup_pengajian_code']=='SELURUH') {
                $_REQUEST['ftgroup_pengajian_code']="%%";
            }

             $paramsx[]=array("name"=>"ftdivision_name",
                          "value"=>base64_decode($_REQUEST['hidden_ftdivision_code']),
                          "type"=>"string");
             $paramsx[]=array("name"=>"ftdepartment_name",
                          "value"=>base64_decode($_REQUEST['hidden_ftdepartment_code']),
                          "type"=>"string");
            $paramsx[]=array("name"=>"ftposition_name",
                          "value"=>base64_decode($_REQUEST['hidden_ftposition_code']),
                          "type"=>"string");
              $paramsx[]=array("name"=>"ftgroup_pengajian_name",
                          "value"=>base64_decode($_REQUEST['hidden_ftgroup_pengajian_code']),
                          "type"=>"string");

            $paramsx[]=array("name"=>"ftdivision_code",
                          "value"=>$_REQUEST['ftdivision_code'],
                          "type"=>"string");
             $paramsx[]=array("name"=>"ftdepartment_code",
                          "value"=>$_REQUEST['ftdepartment_code'],
                          "type"=>"string");
            $paramsx[]=array("name"=>"ftposition_code",
                          "value"=>$_REQUEST['ftposition_code'],
                          "type"=>"string");
            $paramsx[]=array("name"=>"ftgroup_pengajian_code",
                          "value"=>$_REQUEST['ftgroup_pengajian_code'],
                          "type"=>"string");

           $paramsx[]=array("name"=>"date_from",
                          "value"=>Cdate($_REQUEST['pdate_from'])." 00:00:00",
                          "type"=>"date");
          $paramsx[]=array("name"=>"date_end",
                          "value"=>Cdate($_REQUEST['pdate_end'])." 00:00:00",
                          "type"=>"date");
           $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");
		#pr($paramsx);
        show_report($dir."report11_rekap_absensi2",$paramsx);
    break;
      case "h014":
	  
		 if($_REQUEST['ftdepartment_code']=='SELURUH') {
			$_REQUEST['ftdepartment_code']="%%";
		}	  

         $paramsx[]=array("name"=>"date_from",
                          "value"=>Cdate($_REQUEST['pdate_from'])." 00:00:00",
                          "type"=>"date");
		 $paramsx[]=array("name"=>"ftdepartment_code",
					  "value"=>$_REQUEST['ftdepartment_code'],
					  "type"=>"string");
						  
         $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");
		#pr($paramsx);
        show_report($dir."cr03_rekap_thr",$paramsx);
    break;	    
}