<?php
$cate_id = "CNT_DEFECT_WORKER";


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 'getDefectWorker':

      $sql = "USP_P_CNT_DEF_EMP_S10";
      $params = array(
        "WRK_EMP_NO"   => $_REQUEST['worker_pop'] ?: "",
        "WRK_EMP_NM"   => $_REQUEST['sub_worker_pop'] ?: "",
        "DATE_ST"      => $_REQUEST['date_st'] ?: "",
        "DATE_ED"      => $_REQUEST['date_ed'] ?: "",
        "DEPT_CD"      => $_REQUEST['DEPT_CD'] ?: "",
        "DEPT_NM"      => $_REQUEST['DEPT_NM'] ?: "",
      );

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


      break;

  }
}

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