<?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/ppic/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 "ppic01":
        if(strtoupper($_REQUEST['ftitem_code'])=="SELURUH") {
                $ftitem_code="%%";
        }
		else {
				$ftitem_code=$_REQUEST['ftitem_code'];
		}
         $paramsx[]=array("name"=>"trans_no",
                          "value"=>$ftitem_code,
                          "type"=>"string");
         $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string"); 
						  
        show_report($dir."crreport01_bom",$paramsx);

  
    break;
	 case "ppic02":
		
        $paramsx[]=array("name"=>"date_from",
                          "value"=>Cdate($_REQUEST['date_from'])." 00:00:00",
                          "type"=>"date");
        $paramsx[]=array("name"=>"date_end",
                          "value"=>Cdate($_REQUEST['date_end']). " 00:00:00",
                          "type"=>"date");
						  
         $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string"); 
		#pr($paramsx);		  
        show_report($dir."crreport02_estimasi",$paramsx);

  
    break;
	 case "ppic03":
		
        $paramsx[]=array("name"=>"date_from",
                          "value"=>Cdate($_REQUEST['date_from'])." 00:00:00",
                          "type"=>"date");
        $paramsx[]=array("name"=>"date_end",
                          "value"=>Cdate($_REQUEST['date_end']). " 00:00:00",
                          "type"=>"date");
						  
         $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string"); 
		#pr($paramsx);		  
        show_report($dir."crreport03_spp",$paramsx);

  
    break;
    
	
}