Skip to Content
🚀 Welcome to Humansoft Open API Documentation

Get Yearly Report

ดึงรายงานโควตาการลารายปี รองรับผลลัพธ์หลายรูปแบบ: JSON (แบบแบ่งหน้า), Excel และ PDF

Endpoint

GET /api/v1/open-apis/salary/get-data-filter?path_action=get_all_year_quota_report

รองรับทั้ง GET และ POST method — สามารถส่ง filter ผ่าน Query String หรือ Request Body ได้

Request Parameters

ParameterTypeRequiredDescriptionDefaultExample
quota_yearstringYesปีโควตา (YYYY)-"2026"
typestringNoรูปแบบผลลัพธ์ (ดูตารางด้านล่าง)"json""excel"
_pageintegerNoหน้าที่ (เมื่อ type=json)12
_number_per_pageintegerNoจำนวนต่อหน้า (max 500, เมื่อ type=json)50100
count_of_employee_limitintegerNoจำกัดจำนวนพนักงานสูงสุด40005000
check_count_of_employeebooleanNoตรวจจำนวนพนักงานก่อน exporttruefalse
filenamestringNoชื่อไฟล์เมื่อ export-"quota_report_2026"
company_idstringNoกรองตามบริษัท (Base64)--
branch_idstringNoกรองตามสาขา (Base64)--
department_idstringNoกรองตามแผนก (Base64)--
position_idstringNoกรองตามตำแหน่ง (Base64)--
employee_idstringNoกรองเฉพาะพนักงาน (Base64)--
keywordstringNoค้นหาจากชื่อ-นามสกุล, รหัส-"EMP001"
employee_type_codearrayNoกรองตามประเภทพนักงาน-["01"]

Output Types

TypeDescription
jsonผลลัพธ์ JSON แบบแบ่งหน้า (default)
excelไฟล์ Excel (.xlsx)
excel1ไฟล์ Excel แบบมีคอลัมน์ Quota/Used/Remaining
pdfไฟล์ PDF
pdf1ไฟล์ PDF แบบมีคอลัมน์ Quota/Used/Remaining

Response Format

Success Response (type=json)

{ "code": 200, "message": "Success", "payload": { "lists": [ { "employee_code": "EMP001", "employee_name": "สมชาย ใจดี", "department_name": "แผนกบัญชี", "position_name": "พนักงานบัญชี", "quota_year": "2026", "leave_types": [ { "leave_type_code": "01", "leave_type_name": "ลาป่วย", "quota": 30, "used": 5, "remaining": 25 } ] } ], "_TOTAL_RECORDS": 150, "_PAGINATION": { "current_page": 1, "total_pages": 2, "per_page": 100 } } }

Response Fields (type=json)

FieldTypeDescription
listsarrayรายการโควตาพนักงาน
lists[].employee_codestringรหัสพนักงาน
lists[].employee_namestringชื่อ-นามสกุลพนักงาน
lists[].department_namestringชื่อแผนก
lists[].position_namestringชื่อตำแหน่ง
lists[].quota_yearstringปีโควตา
lists[].leave_typesarrayรายการประเภทการลา
lists[].leave_types[].leave_type_codestringรหัสประเภทการลา
lists[].leave_types[].leave_type_namestringชื่อประเภทการลา
lists[].leave_types[].quotanumberโควตาที่ได้รับ
lists[].leave_types[].usednumberโควตาที่ใช้ไป
lists[].leave_types[].remainingnumberโควตาคงเหลือ
_TOTAL_RECORDSnumberจำนวนรายการทั้งหมด
_PAGINATIONobjectข้อมูล pagination

Success Response (type=excel, pdf)

  • Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet (Excel) หรือ application/pdf (PDF)
  • Body: Binary stream ของไฟล์

Error Response

{ "code": 400, "message": "ไม่สำเร็จ", "errors": ["Missing required parameter: 'quota_year'"] }

Payload Too Large (413)

{ "code": 413, "message": "Payload Too Large", "payload": "employee-overlimit" }

ถ้าจำนวนพนักงานเกิน count_of_employee_limit ระบบจะตอบ HTTP 413 — ใช้ filter เพื่อจำกัดขอบเขตให้แคบลง


Code Examples

# ดึงรายงาน JSON แบบแบ่งหน้า curl -X GET "https://openapi.humansoft.co.th/api/v1/open-apis/salary/get-data-filter?path_action=get_all_year_quota_report&quota_year=2026&_page=1&_number_per_page=100" \ -H "Ocp-Apim-Subscription-Key: YOUR_API_KEY" # Export เป็น Excel curl -X GET "https://openapi.humansoft.co.th/api/v1/open-apis/salary/get-data-filter?path_action=get_all_year_quota_report&quota_year=2026&type=excel" \ -H "Ocp-Apim-Subscription-Key: YOUR_API_KEY" \ --output quota_report_2026.xlsx # Export เป็น PDF เฉพาะแผนก curl -X GET "https://openapi.humansoft.co.th/api/v1/open-apis/salary/get-data-filter?path_action=get_all_year_quota_report&quota_year=2026&type=pdf&department_id=MjAyNTEwMDYxOTJGRTg4RTk3QTU=" \ -H "Ocp-Apim-Subscription-Key: YOUR_API_KEY" \ --output quota_report_dept.pdf

Notes

  • เมื่อ type=json ระบบจะแบ่งหน้าอัตโนมัติ (default 50 รายการต่อหน้า, สูงสุด 500)
  • เมื่อ type=excel หรือ type=pdf ระบบจะส่ง binary stream — ใช้ --output ใน cURL เพื่อบันทึกไฟล์
  • ใช้ type=excel1 หรือ type=pdf1 เพื่อดูรายละเอียด Quota/Used/Remaining แยกคอลัมน์
  • ถ้ามีพนักงานจำนวนมาก ใช้ filter เพื่อจำกัดขอบเขตการ export

  • List Quotas - ดูรายการโควตาแบบละเอียด
  • Get Quota by Employee - ดูโควตาของพนักงานคนใดคนหนึ่ง
  • Calculate Quota - คำนวณโควตาการลา
Last updated on