Skip to content

Sale Invoice (รายการขายสินค้า)

List Sale Invoice

เป็นการแสดงรายการขายสินค้า

EndPoint

GET /SMLJavaRESTService/v3/api/invoice

GET /SMLJavaRESTService/v3/api/invoice/{doc_no}

Header

Required SMLRequestHeader

Query Parameter

Transaction Query Paremeter

example:

GET http://localhost:8086/SMLJavaRESTService/v3/api/invoice?from_date=2020-01-01&to_date=2020-01-02

GET http://localhost:8086/SMLJavaRESTService/v3/api/invoice/INV6301-0003

Response Success:

JSON
{
   "success":true,
   "data":[
      {
         "doc_no":"INV6301-0003",
         "doc_date":"2020-01-01",
         "doc_time":"08:55",
         "cust_code":"C00128",
         "cust_name":"โรงงาน อาบาเทก (หน้าห้องน้ำ)",
         "total_value":2648.00,
         "total_discount":0,
         "total_before_vat":2474.77,
         "vat_rate":7.00,
         "total_vat_value":173.23,
         "total_amount":2648.00,
         "transport_name":"บจ.อาบาเทก (หน้าห้องน้ำ)",
         "transport_remark":"",
         "transport_remark_2":"",
         "items":[
            {
               "doc_date":"2020-01-01",
               "item_code":"1-B-01",
               "item_name":"เบอร์ดี้  เอสเพรสโซ เขียว",
               "unit_code":"กระป๋อง",
               "qty":12.00,
               "price":14.00,
               "discount_amount":0,
               "sum_amount":168.00,
               "is_permium":0,
               "line_number":0,
               "tax_type":0,
               "item_category":""
            },
            {
               "doc_date":"2020-01-01",
               "item_code":"1-B-02",
               "item_name":"เบอร์ดี้  โรบัสต้า แดง",
               "unit_code":"กระป๋อง",
               "qty":3.00,
               "price":14.00,
               "discount_amount":0,
               "sum_amount":42.00,
               "is_permium":0,
               "line_number":1,
               "tax_type":0
            },
         ],
         "payment":{
            "doc_no":"INV6301-0003",
            "doc_date":"2020-01-01",
            "trans_type":2,
            "trans_flag":44,
            "doc_group":"",
            "doc_ref":"",
            "book_code":"",
            "description":"",
            "currency_code":"",
            "exchange_rate":0.0,
            "total_amount":2648.00,
            "total_fee_amount":0.0,
            "total_other_amount":0.0,
            "total_tax_at_pay":0,
            "total_net_amount":2648.00,
            "remark":"",
            "status":0,
            "guid_code":"",
            "cash_amount":2648.00,
            "chq_amount":0,
            "tranfer_amount":0,
            "card_amount":0,
            "total_amount_pay":2648.00,
            "total_income_amount":0,
            "deposit_amount":0,
            "advance_amount":0.0,
            "petty_cash_amount":0,
            "doc_time":"08:55",
            "ap_ar_code":"C00128",
            "pay_type":1,
            "doc_format_code":"INV",
            "pay_cash_amount":0.0,
            "money_change":0.0,
            "coupon_amount":0,
            "point_amount":0,
            "point_qty":0,
            "point_rate":0,
            "total_credit_charge":0,
            "branch_code":"",
            "cashier_code":"",
            "sale_shift_id":"",
            "discount_amount":0,
            "total_income_other":0,
            "total_expense_other":0,
            "total_other_currency":0.0,
            "wallet_amount":0,
            "detail":[]
         },
         "sale_code":"RM009"
      }
   ],
   "pages":{
      "size":20,
      "page":1,
      "total_record":12,
      "max_page":1
   }
}

New Invoice

เป็นการสร้างรายการขายสินค้า

EndPoint

POST /SMLJavaRESTService/restapi/saleinvoice

Request Header

Required SMLRequestHeader

Body Data:

JSON body with V2 Data Payload

example

JSON
{
    "doc_no": "INV59120001",
    "doc_date": "2016-12-01",
    "doc_time": "09:00",
    "doc_format_code": "INV",
    "cust_code": "20S0108",
    "sale_code": "1056",
    "sale_type": 1,
    "vat_type": 1,
    "vat_rate": 7,
    "total_value": 10000.00,
    "total_after_vat": 10000.00,
    "total_amount": 10000.00,
    "total_before_vat": 9345.79,
    "total_discount": 0,
    "total_except_vat": 0,
    "total_vat_value": 654.21,
    "cash_amount": 10000.00,
    "details": [
        {
            "item_code": "1000030",
            "line_number": 0,
            "is_permium": 0,
            "unit_code": "TR",
            "wh_code": "CMI01",
            "shelf_code": "CMI420",
            "qty": 100,
            "price": 100,
            "price_exclude_vat": 93.00,
            "sum_amount": 10000.00,
            "discount_amount": 0,
            "vat_amount": 700.00,
            "tax_type": 0,
            "vat_type": 0
        }
    ],
    "paydetails": [
        {
            "pay_type": 2,
            "credit_card_type": "",
            "pay_trans_number": "",
            "pay_amount": 128826.93,
            "no_approved": "",
            "chq_due_date": "",
            "bank_code": "",
            "charge": 0.00,
            "sum_amount": 128826.93
        }
    ],
    "shipment": {
        "transport_name": "",
        "transport_address": "",
        "transport_telephone": "",
        "transport_fax": "",
        "transport_tambon": "",
        "transport_amper": "",
        "transport_province": "",
        "transport_country": "",
        "transport_code": "",
        "destination": "",
        "remark": "",
        "remark_2": "",
        "ship_code": "",
        "logistic_area": "",
        "latitude": "",
        "longitude": ""
    }
}

Response:

Response Success

HTTP Status : 201

Response Success JSON Message

json
{
    "status" :  "success", 
    "message" : "create success"
}

Response Error

HTTP Status : 400

Response Success JSON Message

json
{
    "status" :  "error",
    "message" : "Message Error"
}