<?php
//共通
require_once '../../base/common.php';

/**
 * af227x3共通カスタム関数
 */

/*
callFmAF412Get
*/
function callFmAF412Get($dbutil, $data){
  $logger = new logger(basename(__FILE__));
    global $stringUtil;
$logger->info("callFmAF412Get>>",$data);
    $ret_array = array(
      "ret" => "0", //0:OK, -9:プリンタ登録エラー
      "msg" => "",
      "wseq" => "",
    );
    $ret = '0';

    try {
      
      //liv用(iReport用)に追加。発注データをaw851にinsertするplsqlのコール
      $pwseq = $dbutil->nextVal("innerwseq");
      $whereParams = array();
      $whereParams["wseq"]["in"]   = $pwseq;
      $whereParams["ktktcd"]["in"] = $_SESSION[$GLOBALS['SYSTEM_NAME_EN']]["LGKTKTCD"];
      $whereParams["chgcd"]["in"]  = $_SESSION[$GLOBALS['SYSTEM_NAME_EN']]["CHGCD"];
      $whereParams["dat1"]["in"]   = $data["hdat"];
      $whereParams["mcd"]["in"]    = $data["mcd"];
      $whereParams["vseqs"]["in"]  = $data["vseqs"];
      $whereParams["vseqe"]["in"]  = $data["vseqe"];
      $whereParams["obats"]["in"]  = "";
      $whereParams["ret"]["out"]   = "";
      $sql = file_get_contents("./sql/call_Fm_AF412X_Get.sql");
      $pret_plsql = $dbutil->call($sql,$whereParams);

      //liv用(iReport用)に追加。発注データをaw851にinsertするplsqlの結果を返す
      $ret_array["pret"]  = $pret_plsql["ret"];
      $ret_array["pwseq"] = $pwseq;

    } catch(userException $ue) {
      $ret = '-999';
      $msg = $ue->getErrorMessage();
    } catch(Exception $e) {
      $ret = '-999';
      $msg = $e->getMessage();
    }

    $ret_array["ret"] = $ret;
    $ret_array["msg"] = $msg;
    $ret_array["wseq"] = $wseq;

    return $ret_array;
  }


?>
