<?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";

$dir="report/produksi/print/";
$paramsx=array();

switch ($_REQUEST['form']) {
    case "spk":
        $ssql="select ftspk_no from txspk_hdr where fnid='{$_REQUEST['id']}'";
        $rs=mysql_query($ssql);
        $r=mysql_fetch_assoc($rs);

        $paramsx[]=array("name"=>"trans_no",
                          "value"=>$r["ftspk_no"],
                          "type"=>"string");
         $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");
        $revisi=RetRstField($ssql);
        show_report($dir."crprint01_spk",$paramsx);
   break;
   case "stockinhasilproduksi":
        $ssql="select ftstock_in_no from txtstock_in_production_hdr where fnid='{$_REQUEST['id']}'";
        $rs=mysql_query($ssql);
        $r=mysql_fetch_assoc($rs);

        $paramsx[]=array("name"=>"trans_no",
                          "value"=>$r["ftstock_in_no"],
                          "type"=>"string");
         $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");
        $revisi=RetRstField($ssql);
        
        show_report($dir."crprint02_stock_in_produksi",$paramsx);
   break;
    case "qc":
        $ssql="select ftqc_no from txqc_production_hdr where fnid='{$_REQUEST['id']}'";
        $rs=mysql_query($ssql);
        $r=mysql_fetch_assoc($rs);

        $paramsx[]=array("name"=>"trans_no",
                          "value"=>$r["ftqc_no"],
                          "type"=>"string");
         $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");
        $revisi=RetRstField($ssql);

        show_report($dir."crprint03_qc_produksi",$paramsx);
   break;
     case "spb":
        $ssql="select ftspb_no from txspb_hdr where fnid='{$_REQUEST['id']}'";
        $rs=mysql_query($ssql);
        $r=mysql_fetch_assoc($rs);

        $paramsx[]=array("name"=>"trans_no",
                          "value"=>$r["ftspb_no"],
                          "type"=>"string");
         $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");
        $revisi=RetRstField($ssql);

        show_report($dir."crprint04_spb",$paramsx);
   break;
 case "giling":
        $ssql="select ftgiling_no from txgiling_hdr where fnid='{$_REQUEST['id']}'";
        $rs=mysql_query($ssql);
        $r=mysql_fetch_assoc($rs);

        $paramsx[]=array("name"=>"trans_no",
                          "value"=>$r["ftgiling_no"],
                          "type"=>"string");
         $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");
        $revisi=RetRstField($ssql);

        show_report($dir."crprint05_giling",$paramsx);
   break;
    case "hasilgiling":
        $ssql="select ftgiling_result_no from txgiling_result_hdr where fnid='{$_REQUEST['id']}'";
        $rs=mysql_query($ssql);
        $r=mysql_fetch_assoc($rs);

        $paramsx[]=array("name"=>"trans_no",
                          "value"=>$r["ftgiling_result_no"],
                          "type"=>"string");
         $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");
        $revisi=RetRstField($ssql);

        show_report($dir."crprint06_hasil_giling",$paramsx);
   break;
    case "hasilproduksi":
        $ssql="select ftproduction_no from txproduction_hdr where fnid='{$_REQUEST['id']}'";
        $rs=mysql_query($ssql);
        $r=mysql_fetch_assoc($rs);

        $paramsx[]=array("name"=>"trans_no",
                          "value"=>$r["ftproduction_no"],
                          "type"=>"string");
         $paramsx[]=array("name"=>"username",
                          "value"=>$_SESSION['username'],
                          "type"=>"string");
        $revisi=RetRstField($ssql);

        show_report($dir."crprint02_hasil_produksi",$paramsx);
   break;
   
}