<?php
$cate_id = "CNT_DEFECT_ORDER";
include_once "{$_SERVER['DOCUMENT_ROOT']}/common.inc.php";
include_once _SVC_INC_PATH_ . "/auth_check.php";
include_once _HOME_INC_PATH_ . "/ajax_init.php";

if (!_notAuth("R")) {


  switch ($_REQUEST['mode']) {

    // 부서정보
    case 'getDefOrderList':


      $squl = "USP_P_CNT_DEF_WO_S10";

      $params = array(
        "P_ITEM_GRP" => $_REQUEST["ITEM_GRP"] ?: "",
        "P_ST_DATE"  => $_REQUEST["date_st"],
        "P_ED_DATE"  => $_REQUEST["date_ed"],
        "ITEM_CD"    => $_REQUEST["ITEM_CD_P"],
        "ITEM_NM"    => $_REQUEST["ITEM_NM_P"],
      );

//      print_r($params);
      $rst = $baseObj->DB->exec($squl, $params);

      $rows = array();
      if ($rst) {
        $retval['code'] = true;
        while ($row = $baseObj->DB->fetch_array($rst)) {
          $rows[] = $row;
        }
        ;
        $retval['data'] = $rows;
        $retval['mesg'] = '정상 동작 되었습니다.';
      } else {
        $retval['code'] = false;
      }

      break;
  }
}

if (!$_REQUEST['no_echo']) {
  echo json_encode($retval);
}