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

$logger = new logger(basename(__FILE__));
$logger->info("===af422x_index_start===");
//$logger->info('post', $_POST)

$header = Array(
  "rdo_tcls" => "00", //売上区分：全て
  "rdo_psts" => "0", //未発行
  "sdday" => $_SESSION[$GLOBALS['SYSTEM_NAME_EN']]["SDDAY"],
  "print_mode" => "0",  //0:afw53, 1:納品伝票
  "print_nm" => "AF422X",
);

//POPUP
$assign_var["hasPopCucd"] = "1";
$assign_var["hasPopCuscd"] = "1";
$assign_var["hasPopChgcd"] = "1";

try {
  global $dbutil;

  $valutil = new getValueUtil();
  //出力先有無
  $ret994x = $valutil->getAxm994("AF422X");
  if ($ret994x == null) {
    $header["print_mode"] = "0";
    $header["print_nm"] = "AF422X";
  } else {
    if ($stringUtil->isEmpty($ret994x["r01"])) {
      $header["print_mode"] = "0";
      $header["print_nm"] = "AF422X";
    } else {
      $header["print_mode"] = $ret994x["r01"];
      $header["print_nm"] = $ret994x["r02"];
    }
  }
} catch(userException $ue) {
  $retData["code"]  = $ue->getErrorCode();
  $retData["msg"]   = $ue->getErrorMessage();

  $assign_var["hasError"] = true;
  $assign_var["errorMsg"] = $ue->getErrorMessage();

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

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

  $assign_var["hasError"] = true;
  $assign_var["errorMsg"] = $e->getErrorMessage();

//  $dbutil->rollback();
}

// 初期表示
$dataList = Array(
);
$obj = [];
array_push($dataList, $obj);

$assign_var["header"] = $header;
$logger->info("header", $header);

$logger->info("dataList", $dataList);
$assign_var["dataList"] = $dataList;

//Smartyへアサイン
$logger->info("assign_var",$assign_var);
$smarty->assign($assign_var);
$smarty->display("index");

$logger->info("=== af422x_index_end ===");
?>
