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

//TTDAY取得
function getTTDAY($dbutil, $data){
  $logger = new logger(basename(__FILE__));
    global $stringUtil;
  $logger->info("===getTTDAY===");

  $ret_array = Array(
    "ret" => "0",
  );

  try {
    $whereParams=array();
    $whereParams["ktktcd"] = $data["ktktcd"];
    $sql = file_get_contents("./sql/getTTDAY.sql");
    $logger->info($sql, $whereParams);
    $result = $dbutil->select($sql, $whereParams);
    $logger->info("getTTday_result",$result);

    if($result != null) {
      $ret_array["tday99"] = $result[0]["tday99"];
      $ret_array["tday05"] = $result[0]["tday05"];
      //$tday99 = $result[0]["tday99"];
      //$tday05 = $result[0]["tday05"];
    }

  } catch(userException $ue) {
    $dbutil->rollback();
    $assign_var["hasError"] = true;
    $assign_var["errorMsg"] = $ue->getMessage();
  } catch(Exception $e) {
    $dbutil->rollback();
    $assign_var["hasError"] = true;
    $assign_var["errorMsg"] = $e->getMessage();
  }
  
 // $ret_array["tday99"] = $tday99;
 // $ret_array["tday05"] = $tday05;

  return $ret_array;
}

//SYSDATE取得
function getSYSDAY($dbutil, $data){
  $logger = new logger(basename(__FILE__));
  $logger->info("===getSYSDAY===");

  $ret_array = Array(
  );

  try {
    $whereParams=array();
    $sql = file_get_contents("./sql/getSYSDAY.sql");
  
    $result = $dbutil->select($sql, $whereParams);

    if($result != null) {
      $tday99 = $result[0]["tday99"];
      $tday05 = $result[0]["tday05"];
    }

  } catch(userException $ue) {
    $dbutil->rollback();
    $assign_var["hasError"] = true;
    $assign_var["errorMsg"] = $ue->getMessage();
  } catch(Exception $e) {
    $dbutil->rollback();
    $assign_var["hasError"] = true;
    $assign_var["errorMsg"] = $e->getMessage();
  }
  
  $ret_array["tday99"] = $tday99;
  $ret_array["tday05"] = $tday05;

  return $ret_array;
}
?>
