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