<?php
session_cache_expire(1440);
session_start();
session_name("insys");
include "include/config.php";
include "include/functions.php";
include "include/report_generator.php";

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

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

switch ($code) {

    case "p101":
        if(strtoupper($_REQUEST['supplier_code'])=="") 
            $_REQUEST['supplier_code']="SELURUH";
        
        if(strtoupper($_REQUEST['fnpo_type'])=="") 
            $_REQUEST['fnpo_type']="SELURUH";
        
        if(strtoupper($_REQUEST['ftitem_code'])=="") 
            $_REQUEST['ftitem_code']="SELURUH";

        if(strtoupper($_REQUEST['ftpo_no'])=="") { 
            $_REQUEST['ftpo_no']="SELURUH";
        } else {
            $_REQUEST['ftpo_no']="%{$_REQUEST['ftpo_no']}%";
        }
        
        // Parameter Date From tidak digunakan saat ini
        $_REQUEST['date_from'] = $_REQUEST['date_end'];

        $paramsx[]=array("name"=>"supplier_code",
                          "value"=>$_REQUEST['supplier_code'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"po_type",
                        "value"=>$_REQUEST['fnpo_type'],
                        "type"=>"string");
        $paramsx[]=array("name"=>"ftpo_no",
                        "value"=>$_REQUEST['ftpo_no'],
                        "type"=>"string");
        $paramsx[]=array("name"=>"ftitem_code",
                        "value"=>$_REQUEST['ftitem_code'],
                        "type"=>"string");
        $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");
        show_report($dir."report01_outstanding_po1",$paramsx);
        
        break;
    
    case "p102":
        if(strtoupper($_REQUEST['supplier_code'])=="") 
            $_REQUEST['supplier_code']="SELURUH";
        
        if(strtoupper($_REQUEST['fnpo_type'])=="") 
            $_REQUEST['fnpo_type']="SELURUH";
        
        if(strtoupper($_REQUEST['ftitem_code'])=="") 
            $_REQUEST['ftitem_code']="SELURUH";

        if(strtoupper($_REQUEST['ftpo_no'])=="") { 
            $_REQUEST['ftpo_no']="SELURUH";
        } else {
            $_REQUEST['ftpo_no']="%{$_REQUEST['ftpo_no']}%";
        }
        
        if(strtoupper($_REQUEST['currency_code'])=="") 
            $_REQUEST['currency_code']="SELURUH";
  
        if(strtoupper($_REQUEST['ftsupplier_group'])=="") 
            $_REQUEST['ftsupplier_group']="SELURUH";

        
        $paramsx[]=array("name"=>"po_type",
                          "value"=>$_REQUEST['fnpo_type'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"supplier_code",
                          "value"=>$_REQUEST['supplier_code'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"ftsupplier_group",
                          "value"=>$_REQUEST['ftsupplier_group'],
                          "type"=>"string");	
        $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"=>"item_code",
                          "value"=>$_REQUEST['ftitem_code'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"currency_code",
                          "value"=>$_REQUEST['currency_code'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"ftpo_no",
                          "value"=>$_REQUEST['ftpo_no'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");

         show_report($dir."report02_po_pertransaksi",$paramsx);
         break;
         
    case "p123":
        if(strtoupper($_REQUEST['ftstock_group'])=="") 
            $_REQUEST['ftstock_group']="SELURUH";
        
        if(strtoupper($_REQUEST['ftsupplier_group'])=="") 
            $_REQUEST['ftsupplier_group']="SELURUH";

        if(strtoupper($_REQUEST['ftitem_code'])=="") 
            $_REQUEST['ftitem_code']="SELURUH";
        
        $paramsx[]=array("name"=>"pftstock_group",
                          "value"=>$_REQUEST['ftstock_group'],
                          "type"=>"string");					  
        $paramsx[]=array("name"=>"pftsupplier_group",
                          "value"=>$_REQUEST['ftsupplier_group'],
                          "type"=>"string");					  
        $paramsx[]=array("name"=>"pftitem_code",
                          "value"=>$_REQUEST['ftitem_code'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"pfftotal_qty_min",
                          "value"=>$_REQUEST['fftotal_qty_min'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"pfftotal_qty_max",
                          "value"=>$_REQUEST['fftotal_qty_max'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");
        
        show_report($dir."report27_daftar_harga_barang",$paramsx);
        break;
    
    case "p124":
        if(strtoupper($_REQUEST['supplier_code'])=="") 
            $_REQUEST['supplier_code']="SELURUH";
        
        if(strtoupper($_REQUEST['ftitem_code'])=="") 
            $_REQUEST['ftitem_code']="SELURUH";

        if(strtoupper($_REQUEST['ftpo_no'])=="") { 
            $_REQUEST['ftpo_no']="SELURUH";
        } else {
            $_REQUEST['ftpo_no']="%{$_REQUEST['ftpo_no']}%";
        }
            
        $paramsx[]=array("name"=>"supplier_code",
                          "value"=>$_REQUEST['supplier_code'],
                          "type"=>"string");
        $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"=>"item_code",
                          "value"=>$_REQUEST['ftitem_code'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"ftpo_no",
                          "value"=>$_REQUEST['ftpo_no'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");
                          
        show_report($dir."report28_penerimaan_barang",$paramsx);
        break;
        
  
  case "p125":
        if(strtoupper($_REQUEST['po_type'])=="SELURUH") {
                $_REQUEST['po_type']="%%";
        }
        
        if(strtoupper($_REQUEST['supplier_code'])=="SELURUH") {
                $_REQUEST['supplier_code']="%%";
        }

        if(strtoupper($_REQUEST['item_code'])=="SELURUH") {
                $_REQUEST['item_code']="%%";
        }

        $paramsx[]=array("name"=>"po_type",
                          "value"=>$_REQUEST['po_type'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"supplier_code",
                          "value"=>$_REQUEST['supplier_code'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"item_code",
                          "value"=>$_REQUEST['item_code'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"currency_code",
                          "value"=>$_REQUEST['currency_code'],
                          "type"=>"string");
        $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");

        show_report($dir."report29_purchase_invoice",$paramsx);
    break;

    case "p126":
        $paramsx[]=array("name"=>"ftpo_no",
                          "value"=>$_REQUEST['ftpo_no'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");

        show_report($dir."report30_outsourced",$paramsx);
        break;
    
    case "p127":
        if(strtoupper($_REQUEST['fnpo_type'])=="SELURUH") {
                        $_REQUEST['fnpo_type']="%%";
        }
        
        $paramsx[]=array("name"=>"fnpo_type",
                        "value"=>$_REQUEST['fnpo_type'],
                        "type"=>"string");
        $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");
        show_report($dir."report32_retur_pembelian",$paramsx);
    break;
    
    case "p128":
        
        if(strtoupper($_REQUEST['ftitem_code'])=="") 
            $_REQUEST['ftitem_code']="SELURUH";

        $paramsx[]=array("name"=>"item_code",
                        "value"=>$_REQUEST['ftitem_code'],
                        "type"=>"string");
        $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");
        show_report($dir."report128_pembelian_per_barang",$paramsx);
        break;
    
    
    // Tidak digunakan saat ini
    /* case "p101_1":
        if(strtoupper($_REQUEST['supplier_code'])=="SELURUH") {
                $_REQUEST['supplier_code']="%%";
        }
        if(strtoupper($_REQUEST['fnpo_type'])=="SELURUH") {
                        $_REQUEST['fnpo_type']="%%";
        }
        if(strtoupper($_REQUEST['ftitem_code'])=="SELURUH") {
                        $_REQUEST['ftitem_code']="%%";
        }
     
        // Parameter Date From tidak digunakan saat ini
        $_REQUEST['date_from'] = $_REQUEST['date_end'];

        $paramsx[]=array("name"=>"supplier_code",
                          "value"=>$_REQUEST['supplier_code'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"po_type",
                        "value"=>$_REQUEST['fnpo_type'],
                        "type"=>"string");
        $paramsx[]=array("name"=>"ftitem_code",
                        "value"=>$_REQUEST['ftitem_code'],
                        "type"=>"string");
        $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");
        show_report($dir."report01_outstanding_po2",$paramsx);
        
        break; 
    case "p102_1":
        if(strtoupper($_REQUEST['supplier_code'])=="SELURUH") {
                $_REQUEST['supplier_code']="%%";
        }
        if(strtoupper($_REQUEST['fnpo_type'])=="SELURUH") {
                $_REQUEST['fnpo_type']="%%";
        }
        if(strtoupper($_REQUEST['item_code'])=="SELURUH") {
                $_REQUEST['item_code']="%%";
        }
        $paramsx[]=array("name"=>"po_type",
                          "value"=>$_REQUEST['fnpo_type'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"supplier_code",
                          "value"=>$_REQUEST['supplier_code'],
                          "type"=>"string");
        $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"=>"item_code",
                  "value"=>$_REQUEST['item_code'],
                  "type"=>"string");
        $paramsx[]=array("name"=>"currency_code",
                          "value"=>$_REQUEST['currency_code'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");

         show_report($dir."report02_po_persupplier",$paramsx);
        break;    
    case "p103":
        if(strtoupper($_REQUEST['supplier_code'])=="SELURUH") {
                $_REQUEST['supplier_code']="%%";
        }
        if($_REQUEST['fnpo_type']==0) {
            $created_user="DESTY";
        }
        else {
            $created_user="MELY";
        }
       
        $paramsx[]=array("name"=>"created_user",
                          "value"=>$created_user,
                          "type"=>"string");

        $paramsx[]=array("name"=>"po_type",
                          "value"=>$_REQUEST['fnpo_type'],
                          "type"=>"integer");
                
        $paramsx[]=array("name"=>"supplier_code",
                          "value"=>$_REQUEST['supplier_code'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"date_from",
                          "value"=>Cdate($_REQUEST['date_from'])." 00:00:00",
                          "type"=>"date");
        $paramsx[]=array("name"=>"date_end",
                          "value"=>Cdate($_REQUEST['date_from']). " 00:00:00",
                          "type"=>"date");
        $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");
        show_report($dir."report03_monitoring_incoming_material_pure",$paramsx);
    break;
    case "p103_1":
        if(strtoupper($_REQUEST['supplier_code'])=="SELURUH") {
                $_REQUEST['supplier_code']="%%";
        }
        
        $paramsx[]=array("name"=>"po_type",
                          "value"=>$_REQUEST['fnpo_type'],
                          "type"=>"integer");
        $paramsx[]=array("name"=>"supplier_code",
                          "value"=>$_REQUEST['supplier_code'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"date_from",
                          "value"=>Cdate($_REQUEST['date_from'])." 00:00:00",
                          "type"=>"date");
        $paramsx[]=array("name"=>"date_end",
                          "value"=>Cdate($_REQUEST['date_from']). " 00:00:00",
                          "type"=>"date");
        $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");
        show_report($dir."report03_monitoring_incoming_material_pure_detail",$paramsx);
    break;
    case "p104":
        if(strtoupper($_REQUEST['supplier_code'])=="SELURUH") {
                $_REQUEST['supplier_code']="%%";
        }
			if($_REQUEST['fnpo_type']==0) {
				$created_user="DESTY";
        }
			else {
				$created_user="MELY";
        }
        if(strtoupper($_REQUEST['fnpo_typelpb'])=="SELURUH") {
                $_REQUEST['fnpo_typelpb']="0|1|2|3|4|5|6|7|8";
        }		

        $paramsx[]=array("name"=>"created_user",
                          "value"=>$created_user,
                          "type"=>"string");
        $paramsx[]=array("name"=>"po_type",
                          "value"=>$_REQUEST['fnpo_type'],
                          "type"=>"integer");
        $paramsx[]=array("name"=>"pfnpo_typelpb",
                          "value"=>$_REQUEST['fnpo_typelpb'],
                          "type"=>"string");					  				  
        $paramsx[]=array("name"=>"supplier_code",
                          "value"=>$_REQUEST['supplier_code'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"date_from",
                          "value"=>Cdate($_REQUEST['date_from'])." 00:00:00",
                          "type"=>"date");
        $paramsx[]=array("name"=>"date_end",
                          "value"=>Cdate($_REQUEST['date_from']). " 00:00:00",
                          "type"=>"date");
        $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");
//                          pr($paramsx);
        show_report($dir."report04_monitoring_incoming_material_manipulate",$paramsx);
    break;
    case "p104_1":
        if(strtoupper($_REQUEST['supplier_code'])=="SELURUH") {
                $_REQUEST['supplier_code']="%%";
        }
        $paramsx[]=array("name"=>"po_type",
                          "value"=>$_REQUEST['fnpo_type'],
                          "type"=>"integer");
        $paramsx[]=array("name"=>"supplier_code",
                          "value"=>$_REQUEST['supplier_code'],
                          "type"=>"string");
        $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");
        show_report($dir."report04_monitoring_incoming_material_manipulate_detail",$paramsx);
        break;    
      
       case "p105":
        if(strtoupper($_REQUEST['supplier_code'])=="SELURUH") {
                $_REQUEST['supplier_code']="%%";
        }
        if(strtoupper($_REQUEST['fntax_code'])=="SELURUH") {
                $_REQUEST['fntax_code']="%%";
        }

        $paramsx[]=array("name"=>"pfntax_code",
                          "value"=>$_REQUEST['fntax_code'],
                          "type"=>"string");

        $paramsx[]=array("name"=>"po_type",
                          "value"=>$_REQUEST['fnpo_type'],
                          "type"=>"integer");
                                
        $paramsx[]=array("name"=>"supplier_code",
                          "value"=>$_REQUEST['supplier_code'],
                          "type"=>"string");
        $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");
        if(strtoupper($_REQUEST['item_code'])=="SELURUH") {
                $_REQUEST['item_code']="%%";
        }
        $paramsx[]=array("name"=>"item_code",
                          "value"=>$_REQUEST['item_code'],
                          "type"=>"string");
                                
        if($_REQUEST['fnpo_type']=="0") {
              show_report($dir."report05_schedule_delivery_sisa_po",$paramsx);
        }
        else {
              show_report($dir."report05_schedule_delivery_sisa_po_import",$paramsx);
        }
    break;
    case "p106":
        if(strtoupper($_REQUEST['supplier_code'])=="SELURUH") {
                $_REQUEST['supplier_code']="%%";
        }
        $paramsx[]=array("name"=>"supplier_code",
                          "value"=>$_REQUEST['supplier_code'],
                          "type"=>"string");
        $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");
        if(strtoupper($_REQUEST['item_code'])=="SELURUH") {
                $_REQUEST['item_code']="%%";
        }
        $paramsx[]=array("name"=>"item_code",
                          "value"=>$_REQUEST['item_code'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");
        show_report($dir."report06_masih_penuh",$paramsx);
    break;
    case "p107":
        if(strtoupper($_REQUEST['supplier_code'])=="SELURUH") {
                $_REQUEST['supplier_code']="%%";
        }
        $paramsx[]=array("name"=>"supplier_code",
                          "value"=>$_REQUEST['supplier_code'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"date_from",
                          "value"=>Cdate($_REQUEST['date_from'])." 00:00:00",
                          "type"=>"date");
        $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");
        show_report($dir."report07_pajak",$paramsx);
    break;
    case "p108":
        if(strtoupper($_REQUEST['stockgroup'])=="SELURUH") {
                $_REQUEST['stockgroup']="%%";
        }
 #       if(strtoupper($_REQUEST['supplier_code'])=="SELURUH") {
  #              $_REQUEST['supplier_code']="%%";
   #     }		
        $paramsx[]=array("name"=>"fnimport_local",
                          "value"=>$_REQUEST['fnpo_type'],
                          "type"=>"integer");
        $paramsx[]=array("name"=>"ftstock_group",
                          "value"=>$_REQUEST['stockgroup'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"psupplier",
                          "value"=>$_REQUEST['supplier_code'],
                          "type"=>"string");						  
        $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");
        show_report($dir."report08_harga_supplier_tunggal",$paramsx);
    break;
    case "p109":

        if(strtoupper($_REQUEST['stockgroup'])=="SELURUH") {
                $_REQUEST['stockgroup']="%%";
        }
        if(strtoupper($_REQUEST['supplier_code'])=="SELURUH") {
                $_REQUEST['supplier_code']="%%";
        }		
        $paramsx[]=array("name"=>"fnimport_local",
                          "value"=>$_REQUEST['fnpo_type'],
                          "type"=>"integer");
        $paramsx[]=array("name"=>"ftstock_group",
                          "value"=>$_REQUEST['stockgroup'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"psupplier",
                          "value"=>$_REQUEST['supplier_code'],
                          "type"=>"string");						  
        $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");
        show_report($dir."report09_harga_supplier_yang_barangnya_sama",$paramsx);
    break;
    case "p111":
//        pr($_REQUEST);
        if(($_REQUEST['ftpo_no1']=='')&&($_REQUEST['ftpo_no2']=='')&&($_REQUEST['ftpo_no3']=='')&&($_REQUEST['ftpo_no4']=='')&&($_REQUEST['ftpo_no5']=='')&&($_REQUEST['ftpo_no6']=='')&&($_REQUEST['ftpo_no7']=='')&&($_REQUEST['ftpo_no8']=='')&&($_REQUEST['ftpo_no9']=='')&&($_REQUEST['ftpo_no10']=='')) {
             $paramsx[]=array("name"=>"pfntype1",
                          "value"=>"y",
                          "type"=>"string");
        }
        else {
			$paramsx[]=array("name"=>"pfntype1",
                          "value"=>"x",
                          "type"=>"string");
			 }
        
        $paramsx[]=array("name"=>"ftpo_no1",
                          "value"=>$_REQUEST['ftpo_no1'],
                          "type"=>"string");

        $paramsx[]=array("name"=>"ftpo_no2",
                          "value"=>$_REQUEST['ftpo_no2'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"ftpo_no3",
                          "value"=>$_REQUEST['ftpo_no3'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"ftpo_no4",
                          "value"=>$_REQUEST['ftpo_no4'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"ftpo_no5",
                          "value"=>$_REQUEST['ftpo_no5'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"ftpo_no6",
                          "value"=>$_REQUEST['ftpo_no6'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"ftpo_no7",
                          "value"=>$_REQUEST['ftpo_no7'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"ftpo_no8",
                          "value"=>$_REQUEST['ftpo_no8'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"ftpo_no9",
                          "value"=>$_REQUEST['ftpo_no9'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"ftpo_no10",
                          "value"=>$_REQUEST['ftpo_no10'],
                          "type"=>"string");
        $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."retort10_penyerahan_po_local",$paramsx);
    break;
    case "p112":
        if(strtoupper($_REQUEST['supplier_code'])=="SELURUH") {
                $_REQUEST['supplier_code']="%%";
        }
        if(strtoupper($_REQUEST['item_code'])=="SELURUH") {
                $_REQUEST['item_code']="%%";
        }
        $paramsx[]=array("name"=>"pftitem_code",
                          "value"=>$_REQUEST['item_code'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"pftsupplier_code",
                          "value"=>$_REQUEST['supplier_code'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"pftitem_name",
                          "value"=>base64_decode($_REQUEST['hidden_item_code']),
                          "type"=>"string");
        $paramsx[]=array("name"=>"pftsupplier_name",
                          "value"=>base64_decode($_REQUEST['hidden_supplier_code']),
                          "type"=>"string");
        $paramsx[]=array("name"=>"pdate_from",
                          "value"=>Cdate($_REQUEST['date_from'])." 00:00:00",
                          "type"=>"date");
        $paramsx[]=array("name"=>"pdate_end",
                          "value"=>Cdate($_REQUEST['date_end'])." 00:00:00",
                          "type"=>"date");
        $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");
        show_report($dir."report11_total_qty_harga_barang",$paramsx);
    break;
    case "p113":
		if(strtoupper($_REQUEST['stock_group'])=="SELURUH") {
                            $_REQUEST['stock_group']="%%";
                    }
		$paramsx[]=array("name"=>"pgroup_code",
                          "value"=>$_REQUEST['stock_group'],
                          "type"=>"string");
       
        $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");
        show_report($dir."report23_fifo",$paramsx);
    break;
    case "p113_1": 
        $paramsx[]=array("name"=>"username",
                  "value"=>$_SESSION['username'],
                  "type"=>"string");
        show_report($dir."report25_po_belum_ada_harga",$paramsx);
    break;
    case "p113_2":
        $paramsx[]=array("name"=>"pftitem_code",
                  "value"=>$_REQUEST['item_code'],
                  "type"=>"string");
        $paramsx[]=array("name"=>"username",
                  "value"=>$_SESSION['username'],
                  "type"=>"string");
        show_report($dir."report22_fifo_detail",$paramsx); 
    break;
    case "p114":
        if(strtoupper($_REQUEST['supplier_code'])=="SELURUH") {
                $_REQUEST['supplier_code']="%%";
        }
        if(strtoupper($_REQUEST['item_code'])=="SELURUH") {
                $_REQUEST['item_code']="%%";
        }
        if(strtoupper($_REQUEST['fnpo_typelpb'])=="SELURUH") {
                $_REQUEST['fnpo_typelpb']="%%";
        }
        if(strtoupper($_REQUEST['fnpo_type'])=="SELURUH") {
                $_REQUEST['fnpo_type']="%%";
        }
			$paramsx[]=array("name"=>"pfnpo_type",
                          "value"=>$_REQUEST['fnpo_type'],
                          "type"=>"string");
			$paramsx[]=array("name"=>"pfnpo_typelpb",
                          "value"=>$_REQUEST['fnpo_typelpb'],
                          "type"=>"string");
			$paramsx[]=array("name"=>"pftitem_code",
                          "value"=>$_REQUEST['item_code'],
                          "type"=>"string");
			$paramsx[]=array("name"=>"pftsupplier_code",
                          "value"=>$_REQUEST['supplier_code'],
                          "type"=>"string");
			$paramsx[]=array("name"=>"pftitem_name",
                          "value"=>base64_decode($_REQUEST['hidden_item_code']),
                          "type"=>"string");
			$paramsx[]=array("name"=>"pftsupplier_name",
                          "value"=>base64_decode($_REQUEST['hidden_supplier_code']),
                          "type"=>"string");
			$paramsx[]=array("name"=>"pdate_from",
                          "value"=>Cdate($_REQUEST['date_from'])." 00:00:00",
                          "type"=>"date");
			$paramsx[]=array("name"=>"pdate_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."report13_total_qty_order",$paramsx);
    break;
    case "p115":
        if(strtoupper($_REQUEST['ftpo_no'])=="SELURUH") {
                $_REQUEST['ftpo_no']="%%";
        }
        if(strtoupper($_REQUEST['supplier_code'])=="SELURUH") {
                $_REQUEST['supplier_code']="%%";
        }
        if(strtoupper($_REQUEST['item_code'])=="SELURUH") {
                $_REQUEST['item_code']="%%";
        }
        $paramsx[]=array("name"=>"pftpo_no",
                          "value"=>$_REQUEST['ftpo_no'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"pftitem_code",
                          "value"=>$_REQUEST['item_code'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"pftsupplier_code",
                          "value"=>$_REQUEST['supplier_code'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"fnstatus",
                          "value"=>$_REQUEST['fnstatus'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"pdate_from",
                          "value"=>Cdate($_REQUEST['date_from'])." 00:00:00",
                          "type"=>"date");
        $paramsx[]=array("name"=>"pdate_end",
                          "value"=>Cdate($_REQUEST['date_end']). " 00:00:00",
                          "type"=>"date");
        $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");
        # pr($paramsx);
        if ($_REQUEST['fnstatus']==5) {
            show_report($dir."report20_po_close",$paramsx);
        }
        else if ($_REQUEST['fnstatus']==9) {
            show_report($dir."report20_po_batal",$paramsx);
        }
    break;
	case "p116":
        if(strtoupper($_REQUEST['supplier_code'])=="SELURUH") {
                $_REQUEST['supplier_code']="%%";
        }
        $paramsx[]=array("name"=>"supplier_code",
                          "value"=>$_REQUEST['supplier_code'],
                          "type"=>"string");
        $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");
        if(strtoupper($_REQUEST['item_code'])=="SELURUH") {
                $_REQUEST['item_code']="%%";
        }
        $paramsx[]=array("name"=>"item_code",
                          "value"=>$_REQUEST['item_code'],
                          "type"=>"string");
          $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");
         # pr($paramsx);
        show_report($dir."report16_laporan_perubahan_harga",$paramsx);
    break;
	
    case "p117":
        if(strtoupper($_REQUEST['supplier_code'])=="SELURUH") {
                $_REQUEST['supplier_code']="%%";
        }
        if(strtoupper($_REQUEST['item_code'])=="SELURUH") {
                $_REQUEST['item_code']="%%";
        }
        if(strtoupper($_REQUEST['fntax_code'])=="SELURUH") {
                $_REQUEST['fntax_code']="%%";
        }
        if(strtoupper($_REQUEST['fnpo_type'])=="SELURUH") {
                $_REQUEST['fnpo_type']="%%";
        }
			if ($_REQUEST['fntax_code']=="%%") {
				$tax_po="SELURUH";
			}	
			elseif($_REQUEST['fntax_code']==0) {
				$tax_po="PAJAK";
			}
			else{
				$tax_po="NON PAJAK";
			}	
        $paramsx[]=array("name"=>"pfnpo_type",
                          "value"=>$_REQUEST['fnpo_type'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"pfntax_code",
                          "value"=>$_REQUEST['fntax_code'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"pftitem_code",
                          "value"=>$_REQUEST['item_code'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"pftsupplier_code",
                          "value"=>$_REQUEST['supplier_code'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"pftitem_name",
                          "value"=>base64_decode($_REQUEST['hidden_item_code']),
                          "type"=>"string");
        $paramsx[]=array("name"=>"pftsupplier_name",
                          "value"=>base64_decode($_REQUEST['hidden_supplier_code']),
                          "type"=>"string");
        $paramsx[]=array("name"=>"pdate_from",
                          "value"=>Cdate($_REQUEST['date_from'])." 00:00:00",
                          "type"=>"date");
        $paramsx[]=array("name"=>"pdate_end",
                          "value"=>Cdate($_REQUEST['date_end'])." 00:00:00",
                          "type"=>"date");
        $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");
		$paramsx[]=array("name"=>"tax_po",
						  "value"=>$tax_po,
						  "type"=>"string");
        show_report($dir."report17_laporan_po_bulanan",$paramsx);
    break;
    case "p118":
        if(strtoupper($_REQUEST['fnpo_type'])=="SELURUH") {
                $_REQUEST['fnpo_type']="%%";
        }
        if(strtoupper($_REQUEST['fnsupplier_lama'])=="SELURUH") {
                $_REQUEST['fnsupplier_lama']="%%";
        }
        $paramsx[]=array("name"=>"pfnpo_type",
                      "value"=>$_REQUEST['fnpo_type'],
                      "type"=>"string");
        $paramsx[]=array("name"=>"pfnsupplier_lama",
                      "value"=>$_REQUEST['fnsupplier_lama'],
                      "type"=>"string");                     
        $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");
        show_report($dir."report18_laporan_daftar_pemasok",$paramsx);
    break;

     case "p119":
        if(strtoupper($_REQUEST['ftpo_no'])=="SELURUH") {
                $_REQUEST['ftpo_no']="%%";
        }
        $paramsx[]=array("name"=>"pftpo_no",
                          "value"=>$_REQUEST['ftpo_no'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"pdate_from",
                          "value"=>Cdate($_REQUEST['date_from'])." 00:00:00",
                          "type"=>"date");
        $paramsx[]=array("name"=>"pdate_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."report19_history_pending_delivery_schedule",$paramsx);
    break;
    case "p120":
        $paramsx[]=array("name"=>"pftstock_in_no",
                          "value"=>$_REQUEST['ftstock_in_no'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");
        #pr($paramsx);
        show_report($dir."report21_potongan_lpb",$paramsx);
    break;
	case "p121":
        if($_REQUEST['fnpo_type']=="SELURUH") {
                $_REQUEST['fnpo_type']="%%";
        }
        $paramsx[]=array("name"=>"pfnsupplier_type",
                          "value"=>$_REQUEST['fnpo_type'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");
        #pr($paramsx);
        show_report($dir."report24_syarat_pembayaran",$paramsx);
    break;
	case "p122":
        if(strtoupper($_REQUEST['ftpo_no'])=="SELURUH") {
                $_REQUEST['ftpo_no']="%%";
        }
        if(strtoupper($_REQUEST['supplier_code'])=="SELURUH") {
                $_REQUEST['supplier_code']="%%";
        }
        if(strtoupper($_REQUEST['item_code'])=="SELURUH") {
                $_REQUEST['item_code']="%%";
        }
        $paramsx[]=array("name"=>"pftpo_no",
                          "value"=>$_REQUEST['ftpo_no'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"pftitem_code",
                          "value"=>$_REQUEST['item_code'],
                          "type"=>"string");
        $paramsx[]=array("name"=>"pftsupplier_code",
                          "value"=>$_REQUEST['supplier_code'],
                          "type"=>"string");
                      
                      
        $paramsx[]=array("name"=>"pdate_from",
                          "value"=>Cdate($_REQUEST['date_from'])." 00:00:00",
                          "type"=>"date");
        $paramsx[]=array("name"=>"pdate_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."report26_po_closing",$paramsx);
    break;  
     
     *      */
}