Skip to content

Sale Invoice Service

TypeValue
URL/SMLRESTService/restapi/saleinvoice
MethodPOST
Content-TypeApplication/json

Request Header

namedescription
GUIDGUID สำหรับการเชื่อมต่อ (smlx เสมอ)
configFIleNameชื่อไฟล์เก็บ Server Config
databaseNameชื่อฐานข้อมูล

Example

{
    GUID : smlx
    configFIleName : SMLConfigBRSMLST.xml
    databaseName : smlst2016
}

Data Params

Field NameType
doc_noStringเอกสารเลขที่
doc_format_codeStringรหัสเอกสาร
doc_dateStringเอกสารวันที่
doc_timeStringเวลา
cust_codeStringรหัสลูกค้า
sale_codeStringรหัสพนักงานขาย
sale_typeNumberประเภทการขาย (0=ขายเชื่อ,1=ขายสด)
vat_typeNumberประเภทภาษี (0=แยกนอก,1=รวมใน,2=อัตราภาษีศูนย์)
vat_rateNumberอัตราภาษี
total_valueNumberมูลค่าสินค้า
total_discountNumberมูลค่าส่วนลด
total_before_vatNumberยอดก่อนภาษี
total_vat_valueNumberภาษีมูลค่าเพิ่ม
total_except_vatNumberมูลค่าสินค้ายกเว้นภาษี
total_after_vatNumberมูลค่าหลังคิดภาษี
total_amountNumberมูลค่าสุทธิ
cash_amountNumberยอดเงินสด
chq_amountNumberยอดเช็ค
credit_amountNumberยอดบัตรเครดิต
tranfer_amountNumberยอดเงินโอน
credit_dayNumberจำนวนวันเครดิต**
branch_codeStringสาขา**
remarkStringหมายเหตุ**
diff_amountNumberยอดปัดเศษ (new)**
detailsJSON Arrayรายละเอียดสินค้า
paydetailsJSON Arrayรายละเอียดการชำระเงิน
project_codeStringโครงการ**

** Optional Params

Item Detail

NameType
item_codeStringรหัสสินค้า
line_numberNumberหมายเลขบรรทัด
is_permiumNumber0=สินค้าปรกติ,1=ของแถม
unit_codeStringหน่วยนับ
wh_codeStringคลังสินค้า
shelf_codeStringที่เก็บสินค้า
qtyNumberจำนวน
priceNumberราคา
price_exclude_vatNumberราคาไม่รวมภาษี
discount_amountNumberส่วนลด
sum_amountNumberรวมมูลค่า
vat_amountNumberยอดภาษี
tax_typeNumberประเภทภาษีของสินค้า (0=มีภาษี,1=ยกเว้นภาษี)
vat_typeNumberประเภทภาษี (0=แยกนอก,1=รวมใน,2=อัตราภาษีศูนย์)
sum_amount_exclude_vatNumberมูลค่าไม่รวมภาษี
doc_ref_typeNumberประเภทเอกสารอ้างอิง (1=ใบเสนอราคา 2=สั่งซื้อ/สั่งจอง 3=สั่งขาย)
ref_doc_noStringเลขที่เอกสารอ้างอิง

Payment Detail

NameType
pay_typeNumberประเภทการรับเงิน (1=เงินโอน,2=เช็ค,3=บัตรเครดิต)
pay_trans_numberStringสมุดเงินฝาก/เลขที่เช็ค/เลขที่บัตรเครดิต
credit_card_typeStringประเภทบัตรเครดิต
no_approvedStringเลขที่อนุมัติ
bank_codeStringธนาคาร
pay_amountNumberจำนวนเงิน
chq_due_dateStringวันที่โอน/วันที่บนเช็ค
chargeNumberยอด Charge
sum_amountNumberยอดเงินรวม

Sample Call

{
	"doc_no": "SO59120001",
	"doc_date": "2016-12-01",
	"doc_format_code": "SO",
	"cust_code": "20S0108",
	"sale_code": "1056",
	"vat_rate": 7,
	"total_value": 473103.00,
	"total_after_vat": 506220.21,
	"total_amount": 506220.21,
	"total_before_vat": 473103.00,
	"total_discount": 0,
	"total_except_vat": 0,
	"total_vat_value": 33117.21,

	"doc_time": "09:00",
	"sale_type": 1,
	"vat_type": 0,

	"cash_amount" : 506220.21,
    "chq_amount" : 0,
    "credit_amount" : 0,

	"details": [{
			"item_code": "1000030",
			"line_number": 0,
			"is_permium": 0,
			"unit_code": "TR",
			"wh_code": "CMI01",
			"shelf_code": "CMI420",
			"qty": 100,
			"price": 697.8900,
			"price_exclude_vat": 697.89,
			"sum_amount": 69789.00,
			"discount_amount": 0,
			"vat_amount": 4885.23,
			"tax_type": 0,
			"vat_type": 0,
			"sum_amount_exclude_vat": 69789.00
		}, {
			"item_code": "1000018",
			"line_number": 1,
			"is_permium": 0,
			"unit_code": "TR",
			"wh_code": "CMI01",
			"shelf_code": "CMI420",
			"qty": 300,
			"price": 667.0500,
			"price_exclude_vat": 667.05,
			"sum_amount": 200115.00,
			"discount_amount": 0,
			"vat_amount": 14008.05,
			"tax_type": 0,
			"vat_type": 0,
			"sum_amount_exclude_vat": 200115.00

		}, {
			"item_code": "1000029",
			"line_number": 2,
			"is_permium": 0,
			"unit_code": "TR",
			"wh_code": "CMI01",
			"shelf_code": "CMI420",
			"qty": 100,
			"price": 697.8900,
			"price_exclude_vat": 697.89,
			"sum_amount": 69789.00,
			"discount_amount": 0,
			"vat_amount": 4885.23,
			"tax_type": 0,
			"vat_type": 0,
			"sum_amount_exclude_vat": 69789.00

		}, {
			"item_code": "1000017",
			"line_number": 3,
			"is_permium": 0,
			"unit_code": "TR",
			"wh_code": "CMI01",
			"shelf_code": "CMI420",
			"qty": 200,
			"price": 667.0500,
			"price_exclude_vat": 667.05,
			"sum_amount": 133410.00,
			"discount_amount": 0,
			"vat_amount": 9338.70,
			"tax_type": 0,
			"vat_type": 0,
			"sum_amount_exclude_vat": 133410.00

		}
	],
	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
		}
  	]
}

Response

Response Success
HTTP Status201

Response Success JSON Message

{
    "status" :  "success", 
    "message" : "create success"
}
Response Error
HTTP Status400

Response Success JSON Message

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

With Product Set

{
	"doc_no": "SO59120001",
	"doc_date": "2016-12-01",
	"doc_format_code": "SO",
	"cust_code": "20S0108",
	"sale_code": "1056",
	"vat_rate": 7,
	"total_value": 473103.00,
	"total_after_vat": 506220.21,
	"total_amount": 506220.21,
	"total_before_vat": 473103.00,
	"total_discount": 0,
	"total_except_vat": 0,
	"total_vat_value": 33117.21,

	"doc_time": "09:00",
	"sale_type": 1,
	"vat_type": 0,
	"details": [{
			"item_code": "1000030",
			"line_number": 0,
			"is_permium": 0,
			"unit_code": "TR",
			"wh_code": "CMI01",
			"shelf_code": "CMI420",
			"qty": 100,
			"price": 697.8900,
			"price_exclude_vat": 697.89,
			"sum_amount": 69789.00,
			"discount_amount": 0,
			"vat_amount": 4885.23,
			"tax_type": 0,
			"vat_type": 0,
			"sum_amount_exclude_vat": 69789.00
		}, {
			"item_type" : 3,
			"line_number" : 4,
			"item_code": "1000017",
			"unit_code": "SET",
			"wh_code": "CMI01",
			"shelf_code": "CMI420",
			"qty": 1,
			"childs" : [
				{
					"item_code": "1000029",
					"line_number": 2,
					"is_permium": 0,
					"unit_code": "TR",
					"wh_code": "CMI01",
					"shelf_code": "CMI420",
					"qty": 100,
					"price": 697.8900,
					"price_exclude_vat": 697.89,
					"sum_amount": 69789.00,
					"discount_amount": 0,
					"vat_amount": 4885.23,
					"tax_type": 0,
					"vat_type": 0,
					"sum_amount_exclude_vat": 69789.00

				}, {
					"item_code": "1000017",
					"line_number": 3,
					"is_permium": 0,
					"unit_code": "TR",
					"wh_code": "CMI01",
					"shelf_code": "CMI420",
					"qty": 200,
					"price": 667.0500,
					"price_exclude_vat": 667.05,
					"sum_amount": 133410.00,
					"discount_amount": 0,
					"vat_amount": 9338.70,
					"tax_type": 0,
					"vat_type": 0,
					"sum_amount_exclude_vat": 133410.00

				}
			]
		}
	]
}