<?php
//共通
require_once '../../base/common.php';
require_once './allways.php';
$logger = new logger(basename(__FILE__));
$logger->info("===calcCst_start===");

$response["status"] = "NG";

try {
  global $dbutil;

  $requestBody = file_get_contents('php://input');
  $data = json_decode($requestBody, true);

  $logger->info($data );
  $valutil = new getValueUtil();

  // SQL実行
  $result = $valutil->calc_amt("", $data["pno"], $data["cst"], "2", $_SESSION[$GLOBALS['SYSTEM_NAME_EN']]["LGKTKTCD"], $data["scutaxc"]);

  $logger->info('calcCst_ret',$result );
  $response["status"] = "OK";
  $response["data"]   = $result;

} catch(userException $ue) {
  $retData["code"]  = $ue->getErrorCode();
  $retData["msg"]   = $ue->getErrorMessage();

  $response["status"] = "NG";
  $response["data"]   = $retData;

  $dbutil->rollback();
} catch(Exception $e) {
  $response["status"] = "NG";
  $response["data"]   = $e->getMessage();

  $dbutil->rollback();

} finally {
  print(json_encode($response));
}


$logger->info("=== end01 ===", $response);

?>
