Skip to Content
🚀 Welcome to Humansoft Open API Documentation

Add Actual Leave

เพิ่มบันทึกการลาจริงของพนักงาน ระบบจะหักโควตาอัตโนมัติตามจำนวนวันที่ลา

Endpoint

POST /api/v1/open-apis/salary/add-data-filter

Request Body

ParameterTypeRequiredDescriptionExample
path_actionstringYesต้องเป็น add_actual_leave"add_actual_leave"
employee_codestringYesรหัสพนักงาน (plain text)"EMP001"
work_datestringYesวันที่ลา (YYYY-MM-DD)"2026-03-15"
time_leave_flagstringYesรหัสประเภทการลา (01-09)"06"
absence_daynumberYesจำนวนวันที่ลา (รองรับทศนิยม)1, 0.5
in_yearstringNoปีที่นับโควตา (YYYY) ถ้าไม่ระบุจะใช้ปีจาก work_date"2026"
absence_sum_timestringNoชั่วโมงรวม (สำหรับหน่วยชั่วโมง)"4:00"
time_leave_descstringNoรายละเอียดการลา"ลาพักร้อนประจำปี"
remarkstringNoหมายเหตุ"ธุระส่วนตัว"
language_codestringNoภาษาสำหรับแสดงผล"TH", "EN"

ระบบจะตรวจสอบโควตาคงเหลือก่อนบันทึก ถ้าโควตาไม่เพียงพอจะได้ Error 400


Response Format

Success Response

{ "code": 200, "message": "สำเร็จ", "payload": { "actual_leave_id": "20260315AL01A2B3C4D5", "time_leave_log_id": "20260315TL01A2B3C4D5", "employee_code": "EMP001", "work_date": "2026-03-15", "time_leave_flag": "06", "absence_day": 1, "in_year": "2026", "time_leave_flag_name": "ลาพักร้อน", "quota_before": 7.5, "quota_after": 6.5, "created": "2026-03-15 10:30:00" } }

Response Fields

FieldTypeDescription
actual_leave_idstringID การลาจริง (plain text)
time_leave_log_idstringID บันทึกการลา (plain text)
employee_codestringรหัสพนักงาน
work_datestringวันที่ลา
time_leave_flagstringรหัสประเภทการลา
absence_daynumberจำนวนวันที่ลา
in_yearstringปีที่นับโควตา
time_leave_flag_namestringชื่อประเภทการลา
quota_beforenumberโควตาคงเหลือก่อนบันทึก
quota_afternumberโควตาคงเหลือหลังบันทึก
createdstringวันเวลาที่สร้างรายการ (YYYY-MM-DD HH:mm:ss)

Error Response

{ "code": 400, "message": "ไม่สำเร็จ", "errors": ["Insufficient quota for leave type 06"] }

Code Examples

curl -X POST "https://openapi.humansoft.co.th/api/v1/open-apis/salary/add-data-filter" \ -H "Ocp-Apim-Subscription-Key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "path_action": "add_actual_leave", "employee_code": "EMP001", "work_date": "2026-03-15", "time_leave_flag": "06", "absence_day": 1, "time_leave_desc": "ลาพักร้อนประจำปี" }'

Notes

  • absence_day รองรับทศนิยม: 0.5 = ครึ่งวัน, 1 = เต็มวัน
  • ระบบหักโควตาอัตโนมัติ ดู quota_before และ quota_after เพื่อตรวจสอบ
  • ถ้าไม่ระบุ in_year ระบบจะใช้ปีจาก work_date
  • actual_leave_id และ time_leave_log_id ใช้อ้างอิงสำหรับแก้ไข/ลบภายหลัง

Last updated on