Skip to Content
🚀 Welcome to Humansoft Open API Documentation

Add Petty Cash Item

API สำหรับเพิ่มรายละเอียดค่าใช้จ่าย (เช่น ค่าเดินทาง, ค่าที่พัก, ค่าอุปกรณ์) เข้าไปในเอกสารเบิกเงินสดย่อยที่สร้างไว้แล้ว รองรับการระบุจำนวนเงิน หมวดหมู่การเบิก และการอัปโหลดไฟล์แนบ (Receipt) โดยทุกครั้งที่เพิ่มรายการ ระบบจะคำนวณยอดเงินรวมของเอกสารหลักใหม่โดยอัตโนมัติ

Endpoint

POST /api/v1/open-apis/petty-cash/add-item

Request Body

รองรับ Content-Type: multipart/form-data (แนะนำ) หรือ application/json

Required Parameters

ParameterTypeRequiredDescriptionExample
petty_cash_idstring (base64)Yesรหัสเอกสารหลักที่จะเพิ่มรายการเข้าไป"MjAy..."
petty_cash_item_namestringYesชื่อรายการค่าใช้จ่าย"ค่าน้ำมันรถยนต์"
req_amtnumberYesจำนวนเงินที่เบิก (ทศนิยม 2 ตำแหน่ง)500.00
petty_cash_type_idstring (base64)Yesรหัสประเภทรายการ (ดู API List Types)"MjAy..."
authorize_idstring (base64)YesID ผู้ทำรายการ"MjAy..."

Optional Parameters

ParameterTypeRequiredDescriptionExample
attach_filesfile / arrayNoไฟล์รูปใบเสร็จหรือหลักฐาน (JPG, PNG, PDF)[Binary Data]

Response Format

Success Response

{ "code": 200, "message": "เพิ่มรายการสำเร็จ", "payload": { "petty_cash_id": "20260325PCD00000001", "petty_cash_item_name": "ค่าที่พักโรงแรม", "req_amt": 1200.0, "petty_cash_type_id": "20260303OPTYX0001", "petty_cash_item_id": "123" } }

Response Fields

FieldTypeNullableDescription
petty_cash_idstringNoรหัสเอกสารหลัก
petty_cash_item_namestringNoชื่อรายการค่าใช้จ่ายที่เพิ่ม
req_amtnumberNoจำนวนเงินที่เบิก
petty_cash_type_idstringNoรหัสประเภทรายการ
petty_cash_item_idstringNoรหัสรายการย่อยที่ถูกสร้างขึ้น

Error Response

{ "code": 422, "message": "Validation failed", "errors": ["'req_amt' is required"] }
{ "code": 404, "message": "ไม่พบเอกสารที่ระบุ" }

Code Examples

curl -X POST "https://openapi.humansoft.co.th/api/v1/open-apis/petty-cash/add-item" \ -H "Ocp-Apim-Subscription-Key: YOUR_API_KEY" \ -F "petty_cash_id=MjAyNjAzMjVQQ0QwMDAwMDAwMQ==" \ -F "petty_cash_item_name=ค่าที่พักโรงแรม" \ -F "req_amt=1200.00" \ -F "petty_cash_type_id=MjAyNjAzMDNPUFRZWDAwMDE=" \ -F "authorize_id=MjAyNTAzMDM1MUIwQTJDQ0JEOUM=" \ -F "attach_files=@/path/to/receipt.pdf"

Notes

ขนาดไฟล์แนบแนะนำไม่เกิน 5MB ต่อไฟล์ รองรับไฟล์ประเภท JPG, PNG และ PDF

พารามิเตอร์ petty_cash_id, petty_cash_type_id และ authorize_id ต้องส่งเป็น Base64-encoded


  • Submit - สร้างเอกสารคำขอเบิกเงินสดย่อย
  • List Types - ดูรายการประเภทค่าใช้จ่าย
  • Delete Item - ลบรายการค่าใช้จ่าย
  • Get Detail - ดูรายละเอียดเอกสาร
Last updated on