초기 커밋: 5130 레거시 시스템
- URL 하드코딩 → .env APP_URL 기반 동적 URL로 변경 - DB 연결 하드코딩 → .env 기반으로 변경 - MySQL strict mode DATE 오류 수정
This commit is contained in:
39
account_plan/exclude_item.php
Normal file
39
account_plan/exclude_item.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* 제외 항목 저장
|
||||
*
|
||||
* 이 파일은 클라이언트에서 요청한 제외 항목 정보를 JSON 파일로 저장합니다.
|
||||
*/
|
||||
|
||||
// 에러 표시 설정
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
$yearMonth = $_POST['yearMonth'];
|
||||
$customerName = $_POST['customerName'];
|
||||
$amount = $_POST['amount'];
|
||||
|
||||
// "(주)"는 유지하고 "(계산서발행)" 등 나머지 괄호 내용 제거
|
||||
$cleanCustomerName = preg_replace('/\s*\((?!주\)).*?\)\s*/', '', $customerName);
|
||||
|
||||
// 데이터 유효성 검사 (필요한 경우 추가)
|
||||
$excludedItem = [
|
||||
'yearMonth' => $yearMonth,
|
||||
'customerName' => $cleanCustomerName,
|
||||
'amount' => $amount
|
||||
];
|
||||
|
||||
$excludedItemsFile = $_SERVER['DOCUMENT_ROOT'] . "/account_plan/excluded_items.json";
|
||||
|
||||
$excludedItems = [];
|
||||
if (file_exists($excludedItemsFile)) {
|
||||
$excludedItems = json_decode(file_get_contents($excludedItemsFile), true);
|
||||
}
|
||||
|
||||
$excludedItems[] = $excludedItem;
|
||||
|
||||
file_put_contents($excludedItemsFile, json_encode($excludedItems));
|
||||
|
||||
echo json_encode(['success' => true]);
|
||||
?>
|
||||
Reference in New Issue
Block a user