Calculate Month
สั่งคำนวณเวลาทำงานและเงินเดือนประจำเดือนของพนักงาน สรุปยอดวันทำงาน วันหยุด วันลา มาสาย และค่าล่วงเวลา เพื่อเตรียมข้อมูลสำหรับสลิปเงินเดือน
Endpoint
POST /api/v1/open-apis/salary/update-data-filter?path_action=calculate_monthRequest Body
Required Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
employee_code | string | Yes | รหัสพนักงาน | "EMP001" |
year_month | string | Yes | งวดเดือนที่ต้องการคำนวณ (YYYY-MM) | "2026-02" |
Optional Parameters
| Parameter | Type | Default | Description | Example |
|---|---|---|---|---|
calculate_to | string | "NOW" | คำนวณถึง: "NOW" (วันปัจจุบัน), "END" (วันสิ้นสุดงวด) | "END" |
to_date | string | - | กำหนดวันที่สิ้นสุดการคำนวณเอง (YYYY-MM-DD) | "2026-02-15" |
Validation Rules
| Rule | Description |
|---|---|
employee_code | ต้องมีอยู่ในระบบ |
year_month | ต้องเป็นรูปแบบ YYYY-MM และต้องมีรอบเดือนเปิดอยู่ในระบบ |
- กระบวนการคำนวณอาจใช้เวลา หากต้องการคำนวณหลายคนควรใช้ Calculate Month Queue
- ควรเรียกหลังจากจัดการข้อมูลบันทึกเวลาเสร็จสิ้นแล้ว
Response Format
Success Response
{
"code": 200,
"message": "Calculation success",
"payload": {
"employee_code": "EMP001",
"year_month": "2026-02",
"status": "completed"
}
}Key Response Fields
| Field | Type | Description |
|---|---|---|
employee_code | string | รหัสพนักงาน |
year_month | string | งวดเดือน |
status | string | สถานะการคำนวณ: "completed" |
Error Response
{
"code": 400,
"message": "Master salary report not found for year_month: 2026-02",
"payload": []
}| HTTP Status | Description |
|---|---|
400 | ไม่พบรอบเดือนในระบบ หรือพารามิเตอร์ไม่ถูกต้อง |
401 | API Key ไม่ถูกต้องหรือไม่ได้ส่ง |
404 | ไม่พบพนักงาน |
Code Examples
cURL
# คำนวณถึงวันปัจจุบัน
curl -X POST "https://openapi.humansoft.co.th/api/v1/open-apis/salary/update-data-filter?path_action=calculate_month" \
-H "Ocp-Apim-Subscription-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"employee_code": "EMP001",
"year_month": "2026-02"
}'
# คำนวณถึงวันสิ้นสุดงวด
curl -X POST "https://openapi.humansoft.co.th/api/v1/open-apis/salary/update-data-filter?path_action=calculate_month" \
-H "Ocp-Apim-Subscription-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"employee_code": "EMP001",
"year_month": "2026-02",
"calculate_to": "END"
}'Notes
- API นี้ใช้ method POST และส่งข้อมูลผ่าน request body (JSON)
- ควรเรียกหลังจากจัดการ Time Attendance เสร็จสิ้นแล้ว
- หลังคำนวณสำเร็จ สามารถเรียก Salary Summary หรือ Slip Normal เพื่อดูผลลัพธ์
Related APIs
- Calculate Month Queue - คำนวณหลายคนพร้อมกันแบบ Batch
- Daily In Month - ดูข้อมูลก่อนหรือหลังคำนวณ
- Salary Summary - ดูผลลัพธ์การคำนวณ
- Slip Normal - ดูสลิปเงินเดือนหลังคำนวณ
- Current Month - ดูรอบเดือนปัจจุบัน
Last updated on