Add Employee Welfare
เพิ่มสวัสดิการให้กับพนักงาน โดยระบุประเภทสวัสดิการ ปี และจำนวนเงิน
Endpoint
POST /api/v1/open-apis/employee/add-employee-financial?path_action=welfareQuery Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
path_action | string | Yes | ต้องเป็น welfare |
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
employee_code | string | Yes | รหัสพนักงาน (ไม่ต้อง encode Base64) |
salary_type_id | string | Yes | ID ประเภทสวัสดิการ (ต้อง encode Base64) |
welfare_year | string | Yes | ปีสวัสดิการ (YYYY) |
welfare_prev_amt | number | No | ยอดยกมา (>= 0, default: 0) |
welfare_quota_amt | number | No | โควตาสวัสดิการ วงเงิน (>= 0, default: 0) |
- Endpoint นี้ใช้
employee_code(Plain text) ไม่ใช่employee_id(Base64) - Request parameter
salary_type_idต้อง encode เป็น Base64 - Response fields ที่ลงท้ายด้วย
_idเป็น Plain text ไม่ได้ encode Base64
Response Format
Success Response
{
"code": 200,
"message": "Add Welfare Success",
"payload": {
"welfare_employee_id": "20260213WE01A2B3C4D5",
"employee_id": "20260121FC89F3BB9120",
"salary_type_id": "20250520073EEED41E08",
"welfare_year": "2026",
"welfare_prev_amt": 0,
"welfare_quota_amt": 10000
}
}Response Fields
| Field | Type | Description |
|---|---|---|
code | number | รหัสสถานะ (200 = สำเร็จ) |
message | string | ข้อความตอบกลับ |
payload | object | ข้อมูลที่สร้างสำเร็จ |
payload.welfare_employee_id | string | ID ของสวัสดิการที่สร้าง (Plain text) |
payload.employee_id | string | ID ของพนักงาน (Plain text) |
payload.salary_type_id | string | ID ประเภทสวัสดิการ (Plain text) |
payload.welfare_year | string | ปีสวัสดิการ |
payload.welfare_prev_amt | number | ยอดยกมา |
payload.welfare_quota_amt | number | โควตาสวัสดิการ |
Error Response
{
"code": 400,
"message": "Validation failed",
"errors": ["Missing required parameter: 'employee_code'"]
}Employee Not Found
{
"code": 400,
"message": "Employee not found with code: EMP999"
}Validation Rules
| Field | Rule |
|---|---|
employee_code | ต้องระบุ และต้องมีพนักงานในระบบ |
salary_type_id | ต้องระบุ ต้อง encode Base64 และต้องมีประเภทสวัสดิการในระบบ |
welfare_year | ต้องระบุ ต้องเป็นรูปแบบปี (YYYY) |
welfare_prev_amt | ถ้าระบุ ต้องเป็นตัวเลขและ >= 0 |
welfare_quota_amt | ถ้าระบุ ต้องเป็นตัวเลขและ >= 0 |
Code Examples
cURL
curl -X POST "https://openapi.humansoft.co.th/api/v1/open-apis/employee/add-employee-financial?path_action=welfare" \
-H "Content-Type: application/json" \
-H "Ocp-Apim-Subscription-Key: YOUR_API_KEY" \
-d '{
"employee_code": "EMP001",
"salary_type_id": "MjAyNTA1MjAwNzQzRUVENDFFMDg=",
"welfare_year": "2026",
"welfare_prev_amt": 0,
"welfare_quota_amt": 10000
}'Notes
- ระบบจะสร้าง
welfare_employee_idอัตโนมัติ - หากไม่ระบุ
welfare_prev_amtหรือwelfare_quota_amtจะใช้ค่า 0 - สวัสดิการจะถูกคำนวณยอดคงเหลือ = (ยอดยกมา + โควตา) - ยอดใช้ไป
Related APIs
- List Welfare - ดึงรายการสวัสดิการทั้งหมด
- Get Welfare - ดึงข้อมูลสวัสดิการตาม ID
- Save Welfare - แก้ไขสวัสดิการ
- Delete Welfare - ลบสวัสดิการ
- Add Welfare Log - เพิ่มบันทึกการใช้สวัสดิการ
- Delete Welfare Log - ลบบันทึกการใช้สวัสดิการ
Last updated on