Files
sam-kd/account_juil/get_electronic_bills.php
hskwon aca1767eb9 초기 커밋: 5130 레거시 시스템
- URL 하드코딩 → .env APP_URL 기반 동적 URL로 변경
- DB 연결 하드코딩 → .env 기반으로 변경
- MySQL strict mode DATE 오류 수정
2025-12-10 20:14:31 +09:00

34 lines
1.3 KiB
PHP

<?php
require_once $_SERVER['DOCUMENT_ROOT'] . '/load_GoogleDrive.php';
if (!isset($_SESSION["level"]) || $_SESSION["level"] > 5) {
header("Content-Type: application/json");
echo json_encode(['error' => '권한이 없습니다.']);
exit;
}
require_once($_SERVER['DOCUMENT_ROOT'] . "/lib/mydb.php");
$pdo = db_connect();
try {
// 배서일자가 없는 전자어음 데이터 조회
$sql = "SELECT num, registDate, content, contentSub, content_detail, amount, dueDate
FROM account_juil
WHERE bankbook = '전자어음'
AND (endorsementDate IS NULL OR endorsementDate = '' OR endorsementDate = '0000-00-00')
AND (parentEBNum IS NULL OR parentEBNum = '' )
AND (is_deleted = 0 OR is_deleted IS NULL)
ORDER BY registDate DESC, num DESC";
$stmh = $pdo->prepare($sql);
$stmh->execute();
$results = $stmh->fetchAll(PDO::FETCH_ASSOC);
header("Content-Type: application/json; charset=utf-8");
echo json_encode(['success' => true, 'data' => $results], JSON_UNESCAPED_UNICODE);
} catch (PDOException $e) {
header("Content-Type: application/json; charset=utf-8");
echo json_encode(['error' => '데이터 조회 중 오류가 발생했습니다: ' . $e->getMessage()], JSON_UNESCAPED_UNICODE);
}
?>