Skip to content

Sale Invoice Service

API ใบขายสินค้า (ใบส่งของ/ใบกำกับภาษี)


Header Request

FieldValue
GUIDGUID สำหรับการเชื่อมต่อ (smlx เสมอ)
providerชื่อผู้ใช้บริการ
databaseNameชื่อฐานข้อมูล
configFileNameชื่อไฟล์ตั้งค่า — รูปแบบ SMLConfig<provider>.xml
Content-Typeapplication/json; charset=utf-8

Header Example

json
{
  "GUID": "smlx",
  "provider": "DATA",
  "databaseName": "data1",
  "configFileName": "SMLConfigDATA.xml",
  "Content-Type": "application/json; charset=utf-8"
}

HTTP Response

Statusความหมาย
200สำเร็จ — กรณี GET ที่ไม่พบเอกสารก็ได้ 200 เช่นกัน โดย data เป็น null
400ข้อมูลผิดพลาด (code = 99) เช่น เลขที่เอกสารซ้ำ / ข้อมูลไม่ถูกต้อง — ดูสาเหตุจริงใน message
404เรียก URL / path ไม่ถูกต้อง
405ใช้ HTTP method ไม่ถูกต้อง
500payload ผิดรูป หรือข้อผิดพลาดภายในระบบ

SaleInvoice List

แสดงข้อมูลเอกสารใบขายสินค้า ทั้งหมด

EndPoint

GET /SMLJavaRESTService/saleinvoice/v4

Query Request

FieldDescriptionExample
dateกรองเฉพาะวันเดียว2024-11-15
from_dateตั้งแต่วันที่ (≥) — ใช้คู่กับ to_date ได้2024-01-01
to_dateจนถึงวันที่ (≤) — ใช้คู่กับ from_date ได้2024-12-31
cust_codeรหัสลูกหนี้/เจ้าหนี้AR00016
sale_codeรหัสพนักงานขายS001
pay_typeประเภทการชำระ (cash หรือ credit)cash
doc_noเลขที่เอกสาร (ค้นแบบตรงตัว)IV67110001
last_update_date_timeวันที่แก้ไขล่าสุดตั้งแต่ (≥)2024-11-01
pageหน้าที่ (เริ่ม 1)1
sizeจำนวนต่อหน้า10

หมายเหตุ: ถ้าส่ง date มาแล้ว ระบบจะใช้ date ก่อน (ไม่สนใจ from_date/to_date)

Example:

GET localhost:8084/SMLJavaRESTService/saleinvoice/v4?page=1&size=10
GET localhost:8084/SMLJavaRESTService/saleinvoice/v4?from_date=2024-01-01&to_date=2024-12-31&page=1&size=10
GET localhost:8084/SMLJavaRESTService/saleinvoice/v4?cust_code=AR00016&page=1&size=10

Response Success

json
{
    "success": true,
    "data": {
        "page": 1,
        "size": 10,
        "totalRecord": 35,
        "result": [
            {
                "trans_type": 2,
                "trans_flag": 44,
                "doc_date": "2024-11-15",
                "doc_no": "IV67110001",
                "tax_doc_no": "IV67110001",
                "tax_doc_date": "2024-11-15",
                "inquiry_type": 0,
                "vat_type": 1,
                "cust_code": "AR00016",
                "cust_name": "บจก. ลูกค้าตัวอย่าง",
                "contactor": "",
                "branch_code": "001",
                "sale_code": "S001",
                "sale_name": "พนักงาน ทดสอบ",
                "sale_group": "",
                "send_type": 0,
                "send_day": 0,
                "credit_day": 30,
                "credit_date": "2024-12-15",
                "vat_rate": 7,
                "total_value": 8450.86,
                "total_discount": 0,
                "total_before_vat": 7898,
                "total_vat_value": 552.86,
                "total_after_vat": 8450.86,
                "total_except_vat": 0,
                "total_amount": 8450.86,
                "balance_amount": 0,
                "transport_code": "TR01",
                "transport_name": "บริษัท บลู ซิสเต็ม เทคโนโลยี จำกัด",
                "transport_address": "33/4 เดอะไนน์ ทาวเวอร์ฯ",
                "transport_remark": "ส่งช่วงเช้า",
                "transport_remark_2": "",
                "latitude": 13.7563,
                "longitude": 100.5018,
                "billing_status": true,
                "value_balance": 0,
                "status": 0,
                "approve_status": 0,
                "is_pos": 0,
                "is_cancel": 0,
                "doc_format_code": "IV",
                "doc_time": "14:30",
                "creator_code": "RESTAPI",
                "create_datetime": "2024-11-15 14:30:00",
                "details": null,
                "payment": null
            }
        ]
    }
}

Response Error

json
{
    "error": true,
    "code": "99",
    "message": "error message"
}

SaleInvoice Information

ดึงข้อมูลเอกสารใบขายสินค้า ทีละ 1 เอกสาร พร้อมรายละเอียดสินค้า, ข้อมูลขนส่ง และรายการชำระเงิน

EndPoint

GET /SMLJavaRESTService/saleinvoice/v4/{doc_no}

Path Parameter

NameDescriptionExample
doc_noเลขที่เอกสารIV67110001

Example:

GET localhost:8084/SMLJavaRESTService/saleinvoice/v4/IV67110001

Response Success

json
{
    "success": true,
    "data": {
        "trans_type": 2,
        "trans_flag": 44,
        "doc_date": "2024-11-15",
        "doc_no": "IV67110001",
        "doc_time": "14:30",
        "doc_format_code": "IV",
        "tax_doc_no": "IV67110001",
        "tax_doc_date": "2024-11-15",
        "inquiry_type": 0,
        "vat_type": 1,
        "cust_code": "AR00016",
        "cust_name": "บจก. ลูกค้าตัวอย่าง",
        "contactor": "คุณสมชาย",
        "branch_code": "001",
        "sale_code": "S001",
        "sale_name": "พนักงาน ทดสอบ",
        "sale_group": "",
        "send_type": 0,
        "send_day": 0,
        "credit_day": 30,
        "credit_date": "2024-12-15",
        "vat_rate": 7,
        "discount_word": "",
        "total_value": 8450.86,
        "total_discount": 0,
        "total_before_vat": 7898,
        "total_vat_value": 552.86,
        "total_after_vat": 8450.86,
        "total_except_vat": 0,
        "total_amount": 8450.86,
        "balance_amount": 0,
        "remark": "",
        "transport_code": "TR01",
        "transport_name": "บริษัท บลู ซิสเต็ม เทคโนโลยี จำกัด",
        "transport_address": "33/4 เดอะไนน์ ทาวเวอร์ฯ",
        "transport_remark": "ส่งช่วงเช้า",
        "transport_remark_2": "",
        "latitude": 13.7563,
        "longitude": 100.5018,
        "billing_status": true,
        "value_balance": 0,
        "status": 0,
        "approve_status": 0,
        "is_pos": 0,
        "is_cancel": 0,
        "creator_code": "RESTAPI",
        "create_datetime": "2024-11-15 14:30:00",
        "details": [
            {
                "trans_type": 2,
                "trans_flag": 44,
                "doc_date": "2024-11-15",
                "doc_no": "IV67110001",
                "item_code": "AC-00014",
                "item_name": "น้ำยาบัดกรี",
                "unit_code": "อัน",
                "qty": 4,
                "price": 1974.5,
                "discount": "",
                "discount_amount": 0,
                "sum_amount": 7898,
                "sum_amount_exclude_vat": 7898,
                "price_exclude_vat": 1974.5,
                "total_vat_value": 552.86,
                "tax_type": 0,
                "vat_type": 1,
                "status": 0,
                "line_number": 0,
                "branch_code": "001",
                "wh_code": "CENTER",
                "shelf_code": "CENTER",
                "calc_flag": -1,
                "is_get_price": 1
            }
        ],
        "payment": {
            "doc_no": "RC67110001",
            "doc_date": "2024-11-15",
            "doc_time": "14:30",
            "doc_ref": "IV67110001",
            "trans_type": 1,
            "trans_flag": 12,
            "pay_type": 1,
            "doc_format_code": "RC",
            "book_code": "CASH01",
            "ap_ar_code": "AR00016",
            "currency_code": "THB",
            "exchange_rate": 1,
            "cash_amount": 5000,
            "tranfer_amount": 3450.86,
            "card_amount": 0,
            "chq_amount": 0,
            "wallet_amount": 0,
            "coupon_amount": 0,
            "point_amount": 0,
            "point_qty": 0,
            "money_change": 0,
            "deposit_amount": 0,
            "advance_amount": 0,
            "total_amount": 8450.86,
            "total_amount_pay": 8450.86,
            "total_net_amount": 8450.86,
            "branch_code": "001",
            "cashier_code": "CASH01",
            "status": 0,
            "detail": [
                {
                    "doc_no": "RC67110001",
                    "doc_date": "2024-11-15",
                    "line_number": 1,
                    "doc_type": 1,
                    "trans_number": "TR2024111501",
                    "bank_code": "SCB",
                    "bank_branch": "สาขาสีลม",
                    "amount": 3450.86,
                    "sum_amount": 3450.86,
                    "fee_amount": 0,
                    "no_approved": "",
                    "credit_card_type": "",
                    "remark": "โอนผ่าน SCB",
                    "status": 0,
                    "currency_code": "THB",
                    "period_number": -1
                }
            ]
        }
    }
}

Response Error

json
{
    "error": true,
    "code": "404",
    "message": "Sale Invoice not found: IV67110001"
}

Add SaleInvoice

สร้างเอกสารใบขายสินค้า

ถ้าส่ง field ขนส่งใดๆ มา ระบบจะ INSERT record ใน ic_trans_shipment
ถ้าส่ง payment object มา ระบบจะ INSERT record ใน cb_trans + cb_trans_detail

EndPoint

POST /SMLJavaRESTService/saleinvoice/v4

Body Data:

JSON body with SaleInvoice Request Attribute

example:

json
{
    "doc_no": "IV67110001",
    "doc_date": "2024-11-15",
    "doc_time": "14:30",
    "doc_format_code": "IV",
    "doc_ref": "",
    "doc_ref_date": null,
    "doc_group": "",
    "cust_code": "AR00016",
    "cust_name": "",
    "contactor": "คุณสมชาย",
    "tax_doc_no": "IV67110001",
    "tax_doc_date": "2024-11-15",
    "inquiry_type": 0,
    "vat_type": 1,
    "vat_rate": 7,
    "sale_code": "S001",
    "sale_group": "",
    "branch_code": "001",
    "department_code": "",
    "allocate_code": "",
    "project_code": "",
    "job_code": "",
    "side_code": "",
    "send_type": 0,
    "send_day": 0,
    "send_date": null,
    "credit_day": 30,
    "credit_date": "2024-12-15",
    "expire_day": 0,
    "expire_date": null,
    "on_hold": 0,
    "approve_code": "",
    "user_request": "",
    "cashier_code": "",
    "discount_word": "",
    "total_value": 8450.86,
    "total_discount": 0,
    "total_before_vat": 7898,
    "total_vat_value": 552.86,
    "total_after_vat": 8450.86,
    "total_except_vat": 0,
    "total_amount": 8450.86,
    "remark": "",
    "remark_2": "",
    "remark_3": "",
    "remark_4": "",
    "remark_5": "",

    "transport_code": "TR01",
    "transport_name": "บริษัท บลู ซิสเต็ม เทคโนโลยี จำกัด",
    "transport_address": "33/4 เดอะไนน์ ทาวเวอร์ฯ",
    "transport_remark": "ส่งช่วงเช้า",
    "transport_remark_2": "",
    "latitude": 13.7563,
    "longitude": 100.5018,

    "details": [
        {
            "line_number": 0,
            "item_code": "AC-00014",
            "barcode": "",
            "unit_code": "อัน",
            "qty": 4,
            "price": 1974.5,
            "discount": "",
            "discount_amount": 0,
            "sum_amount": 7898,
            "sum_amount_exclude_vat": 7898,
            "price_exclude_vat": 1974.5,
            "vat_amount": 552.86,
            "tax_type": 0,
            "wh_code": "CENTER",
            "shelf_code": "CENTER",
            "ref_doc_no": "",
            "due_date": null,
            "lot_number_1": "",
            "remark": "",
            "is_permium": 0,
            "is_get_price": 1
        }
    ],

    "payment": {
        "doc_no": "RC67110001",
        "doc_date": "2024-11-15",
        "doc_time": "14:30",
        "doc_ref": "IV67110001",
        "trans_type": 1,
        "trans_flag": 12,
        "doc_format_code": "RC",
        "book_code": "CASH01",
        "ap_ar_code": "AR00016",
        "currency_code": "THB",
        "exchange_rate": 1,
        "pay_type": 1,
        "cash_amount": 5000,
        "tranfer_amount": 3450.86,
        "card_amount": 0,
        "chq_amount": 0,
        "wallet_amount": 0,
        "coupon_amount": 0,
        "point_amount": 0,
        "point_qty": 0,
        "money_change": 0,
        "deposit_amount": 0,
        "advance_amount": 0,
        "total_amount": 8450.86,
        "total_amount_pay": 8450.86,
        "total_net_amount": 8450.86,
        "branch_code": "001",
        "cashier_code": "CASH01",
        "status": 0,
        "detail": [
            {
                "line_number": 1,
                "doc_type": 1,
                "trans_number": "TR2024111501",
                "bank_code": "SCB",
                "bank_branch": "สาขาสีลม",
                "amount": 3450.86,
                "sum_amount": 3450.86,
                "fee_amount": 0,
                "chq_date": null,
                "chq_due_date": null,
                "no_approved": "",
                "credit_card_type": "",
                "remark": "โอนผ่าน SCB",
                "status": 0,
                "currency_code": "THB"
            }
        ]
    }
}

Response Success

json
{
    "success": true,
    "data": {
        "code": "IV67110001"
    }
}

Response Error

json
{
    "error": true,
    "code": "99",
    "message": "error message"
}

SaleInvoice Attribute

ฟิลด์ที่ระบุ (required) คือฟิลด์ที่ต้องส่งใน POST request
ฟิลด์ที่ระบุ (read-only) คือฟิลด์ที่คืนเฉพาะตอน GET เท่านั้น

Field NameField TypeLengthDescription
adjust_reasonString25เหตุผลการปรับปรุง
advance_amountFloatตัดเงินมัดจำ
allocate_codeString25การจัดสรร
answer_typeIntegerลูกค้าตอบกลับ
approve_codeString25กลุ่มผู้อนุมัติ
approve_dateDateวันที่อนุมัติ
approve_statusIntegerสถานะการอนุมัติ
auto_approvedIntegerอนุมัติโดยอัตโนมัติ
auto_createIntegerสร้างโดยโปรแกรม
balance_amountFloatยอดเงินคงเหลือ
billing_statusBooleanสถานะวางบิล (true = ชำระครบ) (read-only)
branch_codeString25สาขา
branch_code_toString25ถึงสาขา
cancel_codeString255ผู้ยกเลิกเอกสาร
cancel_datetimeDateเวลายกเลิกเอกสาร
cancel_typeIntegerประเภทการยกเลิก
cashier_codeString25Cashier
contactorString25ผู้ติดต่อ
create_datetimeDateวันที่สร้างเอกสาร
creator_codeString255ผู้สร้างเอกสาร
credit_dateDateวันที่ครบกำหนด
credit_dayIntegerวันเครดิต
currency_codeString25รหัสสกุลเงิน
currency_moneyFloatยอดคงเหลือ (ตามสกุลเงิน)
cust_codeString25ลูกหนี้/เจ้าหนี้
cust_nameStringชื่อลูกค้า (จาก ar_customer) (read-only)
delivery_dateDateวันที่ส่งของ
department_codeString25แผนก
department_code_toString25ถึงแผนก
deposit_dateDateระยะเวลาภายใน (วันที่)
deposit_dayIntegerระยะเวลาภายใน (วัน)
detailsArrayObjectรายละเอียดสินค้า
discount_wordString25ส่วนลด
discount_word_2String25ส่วนลด (สกุลเงิน)
doc_closeIntegerปิดเอกสาร
doc_dateDateเอกสารวันที่ (required)
doc_format_codeString25รหัสเอกสาร
doc_groupString25กลุ่มเอกสาร
doc_noString25เอกสารเลขที่ (required)
doc_no_guidString25เลขที่เอกสารเปรียบเทียบ
doc_reasonStringเหตุผล
doc_refString255เอกสารอ้างอิง
doc_ref_dateDateเอกสารอ้างอิงวันที่
doc_ref_transStringอ้างอิงเอกสาร
doc_successIntegerสิ้นสุด
doc_timeString5เวลา (HH:mm)
doc_typeIntegerประเภทเอกสาร
due_dateDateวันที่ครบกำหนด
exchange_rateFloatอัตราแลกเปลี่ยน
expire_dateDateวันที่หมดอายุ
expire_dayIntegerจำนวนวันหมดอายุ
expire_statusIntegerสถานะหมดอายุ
extra_wordStringข้อความเพิ่มเติม
guid_codeStringGUID
inquiry_typeIntegerประเภทรายการ
is_cancelIntegerเอกสารยกเลิก
is_doc_copyIntegerเป็นเอกสารที่ออกแทน
is_holdIntegerระงับเอกสาร
is_manual_vatIntegerบันทึกรายการภาษีเอง
is_posIntegerจากระบบ POS (default: 0)
job_codeString25งาน
job_code_toString25ถึงงาน
last_editor_codeString255ผู้แก้ไขเอกสารล่าสุด
last_statusIntegerสถานะล่าสุด
lastedit_datetimeDateวันที่แก้ไขล่าสุด
latitudeFloatละติจูด (เก็บใน ic_trans_shipment)
location_fromStringพื้นที่เก็บ (ต้นทาง)
location_toStringพื้นที่เก็บ (ปลายทาง)
longitudeFloatลองจิจูด (เก็บใน ic_trans_shipment)
lost_profit_exchange_amountFloatผลต่างจากอัตราแลกเปลี่ยน
member_codeString25รหัสสมาชิก
moneyFloatจำนวนเงินคืน
not_approve_1Integerไม่อนุมัติ
on_holdIntegerระงับชั่วคราว
pass_book_codeStringสมุดเงินฝาก
pay_amountFloatเงินชำระ
paymentObjectข้อมูลชำระเงิน
period_guidStringGUID กะ
point_telephoneStringหมายเลขโทรศัพท์
pos_bill_changeInteger0=ปรกติ, 1=ใบแทน
pos_bill_typeInteger0=อย่างย่อ, 1=อย่างเต็ม
pos_idStringหมายเลขเครื่อง POS
pos_transferIntegerโอนมาจาก POS
project_codeString25โครงการ
project_code_toString25ถึงโครงการ
recheck_countIntegerเปิดระบบเตือนตรวจนับซ้ำ
recheck_count_dayFloatเตือนย้อนหลัง (วัน)
ref_amountFloatมูลค่าเอกสารเดิม
ref_diffFloatผลต่าง
ref_new_amountFloatมูลค่าที่ถูกต้อง
remarkString255หมายเหตุ
remark_2String255หมายเหตุ 2
remark_3String255หมายเหตุ 3
remark_4String255หมายเหตุ 4
remark_5String255หมายเหตุ 5
sale_area_codeString25เขตการขาย
sale_codeString25พนักงานขาย
sale_groupString25กลุ่มพนักงานขาย
sale_nameStringชื่อพนักงานขาย (จาก erp_user) (read-only)
sale_shift_idStringรอบการขาย
send_dateDateวันที่รับ/ส่งสินค้า
send_dayIntegerรับ/ส่ง ภายใน (วัน)
send_mailIntegerแจ้งส่งทางอีเมล์
send_smsIntegerแจ้งส่งทาง SMS
send_to_pick_and_packIntegerสั่งจัดสินค้า
send_typeIntegerประเภทการส่ง
sender_codeStringพนักงานขนส่ง
service_charge_wordStringService Charge
side_codeString25ฝ่าย
side_code_toString25ถึงฝ่าย
statusIntegerสถานะ
sum_pay_money_diffFloatผลต่างยอดชำระ
sum_pointFloatแต้ม
sum_point_2Floatยอดแต้มสะสมระบบกลาง
table_numberStringหมายเลขโต๊ะ
tax_doc_dateDateวันที่ใบกำกับ
tax_doc_noString25เลขที่ใบกำกับ
total_after_vatFloatมูลค่าหลังคิดภาษี
total_amountFloatมูลค่าสุทธิ
total_amount_2Floatมูลค่าสุทธิ (สกุลเงิน)
total_amout_oldFloatมูลค่าสุทธิเดิม
total_before_vatFloatยอดก่อนภาษี
total_costFloatต้นทุนสินค้า
total_debt_amountFloatยอดหนี้รวมภาษี
total_discountFloatมูลค่าส่วนลด
total_discount_2Floatมูลค่าส่วนลด (สกุลเงิน)
total_except_vatFloatมูลค่ายกเว้นภาษี
total_manualIntegerบันทึกยอดรวมเอง
total_service_chargeFloatมูลค่า Service Charge
total_vat_valueFloatภาษีมูลค่าเพิ่ม
total_valueFloatมูลค่าสินค้า
total_value_2Floatมูลค่าสินค้า (สกุลเงิน)
trans_flagIntegerรายวันระบบ (44 = ใบขายสินค้า, auto)
trans_typeIntegerประเภทรายวัน (2 = ขาย, auto)
transport_addressString1000ที่อยู่จัดส่ง (เก็บใน ic_trans_shipment)
transport_codeString25ขนส่งโดย
transport_nameString255ชื่อผู้รับ (เก็บใน ic_trans_shipment)
transport_remarkString255หมายเหตุจัดส่ง (เก็บใน ic_trans_shipment.remark)
transport_remark_2String255หมายเหตุจัดส่ง 2 (เก็บใน ic_trans_shipment.remark_2)
transport_valueFloatค่าขนส่ง
used_statusIntegerมีการอ้างอิงแล้ว
used_status_2Integerสถานะ 2
user_approveStringผู้อนุมัติ
user_requestStringผู้ขออนุมัติ
value_balanceFloatยอดคงค้าง (total_amount − ยอดรับชำระ) (read-only)
vat_rateFloatอัตราภาษี
vat_typeIntegerประเภทภาษี (0=แยกนอก, 1=รวมใน, 2=ยกเว้นภาษี, 3=ไม่กระทบภาษี) — หมายเหตุ: ค่าคนละชุดกับ detail
want_dateDateต้องการภายใน (วันที่)
want_dayIntegerต้องการภายใน (วัน)
wh_fromStringคลัง (ต้นทาง)
wh_toStringคลัง (ปลายทาง)

SaleInvoice Detail

ฟิลด์ที่ระบุ (required) คือฟิลด์ที่ต้องส่งใน POST request

Field NameField TypeLengthDescription
auto_createIntegerสร้างโดยโปรแกรม
average_costFloatราคาทุนเฉลี่ย
average_cost_1Floatราคาทุนเฉลี่ยแฝง
bank_branchStringสาขาธนาคาร
bank_branch_2Stringสาขาธนาคาร 2
bank_nameStringธนาคาร
bank_name_2Stringธนาคาร 2
barcodeString25Barcode
bat_dateDatebat date
bat_numberStringbat number
branch_codeString25สาขา
calc_flagIntegerบวกหรือลบ (1=บวก, -1=ลบ, default: -1)
cancel_qtyFloatจำนวนยกเลิก
chq_numberStringเลขที่เช็ค
create_datetimeDateวันที่สร้างเอกสาร
creator_codeStringผู้สร้างเอกสาร
currency_codeString25สกุลเงิน
cust_codeString25ลูกหนี้/เจ้าหนี้
date_dueDateวันครบกำหนด
date_expireDateหมดอายุ
department_codeString25แผนก
discountString25ส่วนลด
discount_amountFloatมูลค่าส่วนลด
discount_amount_2Floatมูลค่าส่วนลด (สกุลเงิน)
discount_changedIntegerมีการแก้ไขส่วนลด
discount_numberIntegerหมายเลขส่วนลด
divide_valueFloatตัวหาร
doc_dateDateเอกสารวันที่
doc_date_calcDateวันที่สำหรับคำนวณ
doc_groupStringกลุ่มเอกสาร
doc_noString25เอกสารเลขที่
doc_refStringเอกสารอ้างอิง
doc_ref_typeIntegerประเภทเอกสารอ้างอิง
doc_timeStringเวลา
doc_time_calcStringเวลาสำหรับคำนวณ
due_dateDateวันที่ต้องการ
exchange_rateFloatอัตราแลกเปลี่ยน
exchange_rate_oldFloatอัตราแลกเปลี่ยนเดิม
fee_amountFloatค่าธรรมเนียม
hidden_cost_1Floatต้นทุนแฝงบริหาร
hidden_cost_1_exclude_vatFloatต้นทุนแฝงบริหารไม่รวมภาษี
hidden_cost_2Floatต้นทุนแฝงบัญชี
hidden_cost_2_exclude_vatFloatต้นทุนแฝงบัญชีไม่รวมภาษี
ic_colorStringสีสินค้า
ic_patternStringรูปแบบสินค้า
ic_sizeStringขนาดสินค้า
inquiry_typeIntegerประเภทการซื้อ
is_doc_copyIntegerเป็นเอกสารที่ออกแทน
is_get_priceIntegerให้ดึงราคาขาย (1=ดึง)
is_lock_costIntegerกำหนดต้นทุนเอง
is_permiumInteger1=ของแถม
is_posIntegerจาก POS
is_serial_numberIntegerมีหมายเลขเครื่อง
item_codeString25รหัสสินค้า
item_code_2String25รหัสสินค้า 2
item_code_mainString25สินค้าหลัก
item_nameString255ชื่อสินค้า
item_typeIntegerประเภทสินค้า
last_editor_codeStringผู้แก้ไขเอกสารล่าสุด
last_statusIntegerสถานะล่าสุด (0=Normal, 1=ยกเลิก)
lastedit_datetimeDateวันที่แก้ไขล่าสุด
line_numberIntegerบรรทัด
lot_number_1Stringเลข LOT
mfd_dateDateวันที่ผลิต
mfn_codeStringรหัสผู้ผลิต
mfn_nameStringผู้ผลิต
priceFloatราคา
price_2Floatราคา (สกุลเงิน)
price_baseFloatราคากลาง
price_changedIntegerมีการแก้ไขราคา
price_defaultFloatราคาเริ่มต้น
price_exclude_vatFloatราคาไม่รวมภาษี
price_guidStringPrice Guid
price_modeIntegerกลุ่มราคา
price_set_ratioFloatอัตราส่วนราคาสินค้าชุด
price_typeIntegerประเภทราคา
priority_levelIntegerความสำคัญ
product_weekStringสัปดาห์ที่ผลิต
product_yearStringปีที่ผลิต
profit_lost_cost_amountFloatกำไรขาดทุน
promotion_codeStringรหัสโปรโมชั่น
qtyFloatจำนวน
qty_2Floatจำนวนขาย
ratioFloatอัตราส่วน
ref_cust_codeString25อ้างอิง เจ้าหนี้/ลูกหนี้
ref_doc_dateDateอ้างอิง วันที่
ref_doc_noString25อ้างอิงเอกสาร
ref_guidStringref_guid
ref_line_numberIntegerอ้างอิง บรรทัด
ref_rowIntegerref_row
remarkString255หมายเหตุ
sale_codeString25รหัสพนักงานขาย
sale_groupString25กลุ่มพนักงานขาย
sale_shift_idStringรอบการขาย
set_ref_lineStringบรรทัดอ้างอิง (สินค้าชุด)
set_ref_priceFloatราคาอ้างอิง (สินค้าชุด)
set_ref_qtyFloatจำนวนอ้างอิง (สินค้าชุด)
shelf_codeString25พื้นที่เก็บ
shelf_code_2String25พื้นที่เก็บ 2
stand_valueFloatตัวตั้ง
statusIntegerสถานะ
sum_amountFloatรวมมูลค่า
sum_amount_2Floatรวมมูลค่า (สกุลเงิน)
sum_amount_exclude_vatFloatรวมมูลค่าไม่รวมภาษี
sum_of_costFloatรวมต้นทุน
sum_of_cost_1Floatต้นทุนรวมต้นทุนแฝงบริหาร
sum_of_cost_fixFloatต้นทุน (กำหนดเอง)
tax_typeIntegerประเภทภาษี (0=มีภาษี, 1=ยกเว้น)
temp_float_1Floatตัวเลข 1
temp_float_2Floatตัวเลข 2
temp_string_1Stringตัวอักษร 1
total_qtyFloatจำนวนคงเหลือ
total_sizeFloatรวมหน่วยนับ 2
total_vat_valueFloatภาษีมูลค่าเพิ่ม
trans_flagIntegerรายวันระบบ (44 = ใบขายสินค้า, auto)
trans_typeIntegerประเภทรายวัน (2 = ขาย, auto)
transfer_amountFloatยอดโอนเงิน
unit_codeString25หน่วยนับ
unit_code_2String25หน่วยช่วยขาย
unit_sizeFloatขนาดสินค้า
user_approveStringรหัสผู้อนุมัติ
vat_typeIntegerประเภทภาษี (0=แยกนอก, 1=รวมใน, 2=อัตรา 0)
wh_codeString25คลัง
wh_code_2String25คลัง 2

Payment Attribute

โครงสร้าง payment object (เก็บใน cb_trans)

ส่ง payment มาตอน POST → ระบบจะ INSERT record ใน cb_trans + cb_trans_detail
ตอน GET ระบบจะค้น cb_trans ด้วย cb_trans.doc_ref = ic_trans.doc_no

Field NameField TypeLengthDescription
advance_amountFloatตัดเงินมัดจำ
ap_ar_codeString25รหัสเจ้าหนี้/ลูกหนี้ (default = cust_code ของเอกสาร)
book_codeString25สมุดรายวัน
branch_codeString25รหัสสาขา
card_amountFloatยอดบัตรเครดิต
cash_amountFloatยอดเงินสด
cashier_codeString25Cashier
chq_amountFloatยอดเช็ค
coupon_amountFloatยอดชำระด้วยคูปอง
currency_codeString25รหัสสกุลเงิน
deposit_amountFloatยอดตัดเงินล่วงหน้า
descriptionStringรายละเอียด
detailArrayObjectรายละเอียดการชำระ
discount_amountFloatส่วนลดชำระเงิน
doc_dateDateเอกสารวันที่ (default = doc_date ของใบขาย)
doc_format_codeString25รหัสรูปแบบเอกสาร
doc_groupStringกลุ่มเอกสาร
doc_noString25เอกสารเลขที่ของใบรับเงิน (required ใน payment)
doc_refStringเอกสารอ้างอิง (default = doc_no ของใบขาย)
doc_timeString5เวลา
exchange_rateFloatอัตราแลกเปลี่ยน
guid_codeStringGUID
is_doc_copyIntegerเป็นเอกสารออกแทน
money_changeFloatเงินทอน
pay_cash_amountFloatจ่ายเงิน
pay_typeInteger1=รับ, 2=จ่าย
petty_cash_amountFloatเงินสดย่อย
point_amountFloatยอดชำระด้วยแต้ม
point_qtyFloatจำนวนแต้มที่ใช้
point_rateFloatแต้มต่อบาท
remarkStringหมายเหตุ
sale_shift_idStringรอบการขาย
statusIntegerสถานะ
total_amountFloatรวมยอดเงิน
total_amount_payFloatรวมจ่าย
total_credit_chargeFloatค่า Charge บัตรเครดิต
total_expense_otherFloatรายจ่ายอื่น
total_fee_amountFloatค่าธรรมเนียม
total_income_amountFloatปัดเศษ
total_income_otherFloatรายได้อื่น
total_net_amountFloatยอดรวมทั้งสิ้น
total_other_amountFloatปัดเศษ (ลด)
total_other_currencyFloatสกุลเงินอื่นๆ
total_tax_at_payFloatภาษีหัก ณ ที่จ่าย
tranfer_amountFloatยอดเงินโอน (สะกดตามฐานข้อมูล)
trans_flagIntegerรายวันระบบ
trans_typeIntegerประเภทรายวัน (1=รับเงิน, 2=จ่ายเงิน)
wallet_amountFloatWallet Payment

Payment Detail

โครงสร้าง payment.detail[] (เก็บใน cb_trans_detail) — รายการย่อยของการชำระเงินแยกตามวิธี (เช่น แต่ละใบเช็ค, แต่ละบัตรเครดิต, แต่ละการโอน)

Field NameField TypeLengthDescription
amountFloatจำนวนเงิน
ap_ar_codeString25รหัสเจ้าหนี้/ลูกหนี้ (default = cust_code ของเอกสาร)
ap_ar_typeInteger1=ลูกหนี้, 2=เจ้าหนี้
approve_codeString25กลุ่มผู้อนุมัติ
approve_dateDateวันที่อนุมัติ
balance_amountFloatยอดคงเหลือ
bank_branchStringสาขาธนาคาร
bank_codeStringรหัสธนาคาร
chargeFloatยอด Charge
chq_dateDateวันที่ออกเช็ค/รับเช็ค
chq_due_dateDateวันที่บนเช็ค
chq_on_handIntegerประเภทเช็ค
chq_refStringอ้างอิงเช็คเลขที่
credit_card_typeStringประเภทบัตรเครดิต
currency_codeStringรหัสสกุลเงิน
doc_dateDateเอกสารวันที่ (default = doc_date ของ payment header)
doc_date_refDateวันที่อ้างอิง
doc_groupStringกลุ่มเอกสาร
doc_noString25เอกสารเลขที่ (auto fill = payment.doc_no)
doc_refStringเอกสารอ้างอิง
doc_timeStringเวลา
doc_typeInteger1=เงินโอน, 2=เช็ค, 3=บัตรเครดิต, 4=เงินสดย่อย, 5=เงินล่วงหน้า, 9=คูปอง, 11=จ่ายอื่น, 12=รับอื่น, 19=สกุลเงินอื่น, 21=eWallet
exchange_rateFloatอัตราแลกเปลี่ยน
external_chqIntegerการเรียกเก็บ
fee_amountFloatค่าธรรมเนียม
is_doc_copyIntegerเอกสารออกแทน
last_statusIntegerสถานะล่าสุด
line_numberIntegerบรรทัด (auto +1 ถ้าไม่ส่ง)
no_approvedStringเลขที่อนุมัติ
other_amountFloatค่าใช้จ่ายอื่นๆ
pass_book_codeStringสมุดเงินฝาก
period_numberIntegerงวดที่
ref1Stringเลขที่อ้างอิง 1
ref2Stringเลขที่อ้างอิง 2
remarkStringหมายเหตุ
sale_shift_idStringรอบการขาย
statusIntegerสถานะ
sum_amountFloatยอดเงินรวม
sum_amount_2Floatรวมจำนวนเงิน (สกุลเงิน)
tax_at_payFloatภาษีหัก ณ ที่จ่าย
trans_flagIntegerรายวันระบบ
trans_numberStringเลขที่เช็ค/เลขที่อนุมัติ
trans_number_typeIntegerประเภท (1=รับ, 2=จ่าย)
trans_typeIntegerประเภทรายวัน