Skip to Content
🚀 Welcome to Humansoft Open API Documentation

Add Employee Welfare

เพิ่มสวัสดิการให้กับพนักงาน โดยระบุประเภทสวัสดิการ ปี และจำนวนเงิน

Endpoint

POST /api/v1/open-apis/employee/add-employee-financial?path_action=welfare

Query Parameters

ParameterTypeRequiredDescription
path_actionstringYesต้องเป็น welfare

Request Body

ParameterTypeRequiredDescription
employee_codestringYesรหัสพนักงาน (ไม่ต้อง encode Base64)
salary_type_idstringYesID ประเภทสวัสดิการ (ต้อง encode Base64)
welfare_yearstringYesปีสวัสดิการ (YYYY)
welfare_prev_amtnumberNoยอดยกมา (>= 0, default: 0)
welfare_quota_amtnumberNoโควตาสวัสดิการ วงเงิน (>= 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

FieldTypeDescription
codenumberรหัสสถานะ (200 = สำเร็จ)
messagestringข้อความตอบกลับ
payloadobjectข้อมูลที่สร้างสำเร็จ
payload.welfare_employee_idstringID ของสวัสดิการที่สร้าง (Plain text)
payload.employee_idstringID ของพนักงาน (Plain text)
payload.salary_type_idstringID ประเภทสวัสดิการ (Plain text)
payload.welfare_yearstringปีสวัสดิการ
payload.welfare_prev_amtnumberยอดยกมา
payload.welfare_quota_amtnumberโควตาสวัสดิการ

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

FieldRule
employee_codeต้องระบุ และต้องมีพนักงานในระบบ
salary_type_idต้องระบุ ต้อง encode Base64 และต้องมีประเภทสวัสดิการในระบบ
welfare_yearต้องระบุ ต้องเป็นรูปแบบปี (YYYY)
welfare_prev_amtถ้าระบุ ต้องเป็นตัวเลขและ >= 0
welfare_quota_amtถ้าระบุ ต้องเป็นตัวเลขและ >= 0

Code Examples

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
  • สวัสดิการจะถูกคำนวณยอดคงเหลือ = (ยอดยกมา + โควตา) - ยอดใช้ไป

  • List Welfare - ดึงรายการสวัสดิการทั้งหมด
  • Get Welfare - ดึงข้อมูลสวัสดิการตาม ID
  • Save Welfare - แก้ไขสวัสดิการ
  • Delete Welfare - ลบสวัสดิการ
  • Add Welfare Log - เพิ่มบันทึกการใช้สวัสดิการ
  • Delete Welfare Log - ลบบันทึกการใช้สวัสดิการ
Last updated on