Sell Documents

Get all documents

Method : GET
Endpoint : /api/sell_doc

{
	"data": [
		{
			"SELL_DOC_ID": 1, //Unique document id
			"CLIENT_ID": 1, //Client id
			"PAYER_ID": 1, //Payer (client) id
			"ENTERED": "19.07.2022", //Creation date
			"SELL_DATE": "19.07.2022", //Document date
			"MUST_PAY": "29.07.2022", //Must pay until
			"ISSUE_DATE": "19.07.2022", //Issue date
			"UPDATED": null, //Last updated
			"STOCK_NAME_ID": 1, //Storehouse id
			"DOC_TYPE": "J", //Document type
			"DOC_PAY_TYPE": "B", //Document payment type
			"DOC_SER_NR": "WEB", //Document serial number
			"DOC_NR": "12", //Document number
			"CURRENCY_ID": 1, //Currency id
			"CURRENCY_RATE": 1, //Currency rate
			"STATUS": "0", //Status if document is locked 0 = open C = closed
			"MANAGER_ID": 1, //Client manager id
			"SELL_MANAGER_ID": 1, //Document manager id
			"NOTES": "", //Document notes
			"PIEGADES_ADRESE": "Maskavas 1, Riga, LV-1063", // delivery address
			"CLIENT_BANK_NAME": "Swedbank AS", // bank name
			"CLIENT_BANK_CODE": "HABALV22", // bank code
			"CLIENT_BANK_ACCOUNT": "LV46HABA0551003384489", // bank account
			"ETRADER_DELIVERY_TYPE_ID": null, //Delivery type id
			"ORDER_STATUS_ID": 1, //Order status id
			"status_log": [ //Status change log
				{
					"ENTERED": "19.07.2022, 14:22:18",
					"ORDER_STATUS_ID": 1
				}
			],
			"DPD_ORDER_ID": null, //DPD tracking codes
			"OMNIVA_ORDER_ID": null, //Omniva tacking codes
			"VENIPAK_ORDER_ID": null, //Venipack trackig codes
			"delivery_type": null, 
			"EXTERNAL_ID": null, //External id (can be user specified)
			"TOTALS": { //Document total price
				"WO_VAT": 1322.52,
				"VAT": 277.73,
				"W_VAT": 1600.25
			},
			"PAYD": 0, //Payment amount
			"EMAIL": "epasts@kompanija.lv", // email
			"client": {
				"CLIENT_ID": 1, //Client id
				"CLIENT_NAME": "Kompānija SIA", //Client name
				"IS_FIZISKA": false, //Is private person (if false then company)
				"REG_NR": "123123123", //Client registration number
				"PVN_REG_NR": "LV123123123", //Client vat registration number
				"ADDRESS": "Rīga, Rīgas iela 2", //Address
				"LEGAL_ADDRESS": "Rīga, Rīgas iela 2", //Legal address
				"PHONE": "", // Phone
				"EMAIL": "", //Email
				"banks": [ //Client banks
					{
						"bank": {
							"BANK_ID": 18,
							"BANK_CODE": "PARXLV22",
							"BANK_SWIFT_CODE": "PARXLV22",
							"BANK_NAME": "AS Citadele banka"
						},
						"ACCOUNT": "87654321345678900",
						"IS_DEFAULT": "F"
					}
				]
			},
			"payer": null, //Structure the same as client
		}
	],
	"links": {
		"first": "/api/sell_doc?page=1",
		"last": "/api/sell_doc?page=100",
		"prev": null,
		"next": "/api/sell_doc?page=2"
	},
	"meta": {
		"current_page": 1,
		"from": 1,
		"last_page": 122,
		"path": "/api/sell_doc",
		"per_page": 1,
		"to": 1,
		"total": 122
	}
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89

Get only changed sell docs

Method : GET
Endpoint : /api/sell_doc/changes

TIP

Returns changed sell documents by default within the last hour or specified timestamp (if date is specified). Example:

https://<yourdomain>/api/sell_doc/changes?token=<your_token>&date=1672527661

Get single document

Method : GET
Endpoint : /api/sell_doc/{id}

{
	"SELL_DOC_ID": 1, //Unique document id
	"CLIENT_ID": 1, //Client id
	"PAYER_ID": 1, //Payer (client) id
	"ENTERED": "19.07.2022", //Creation date
	"SELL_DATE": "19.07.2022", //Document date
	"MUST_PAY": "29.07.2022", //Must pay until
	"ISSUE_DATE": "19.07.2022", //Issue date
	"UPDATED": null, //Last updated
	"STOCK_NAME_ID": 1, //Storehouse id
	"DOC_TYPE": "J", //Document type
	"DOC_PAY_TYPE": "B", //Document payment type
	"DOC_SER_NR": "WEB", //Document serial number
	"DOC_NR": "12", //Document number
	"CURRENCY_ID": 1, //Currency id
	"CURRENCY_RATE": 1, //Currency rate
	"STATUS": "0", //Status if document is locked 0 = open C = closed
	"MANAGER_ID": 1, //Client manager id
	"SELL_MANAGER_ID": 1, //Document manager id
	"NOTES": "", //Document notes
	"PIEGADES_ADRESE": "Maskavas 1, Riga, LV-1063", // delivery address
	"CLIENT_BANK_NAME": "Swedbank AS", // bank name
	"CLIENT_BANK_CODE": "HABALV22", // bank code
	"CLIENT_BANK_ACCOUNT": "LV46HABA0551003384489", // bank account
	"ETRADER_DELIVERY_TYPE_ID": null, //Delivery type id
	"ORDER_STATUS_ID": 1, //Order status id
	"status_log": [ //Status change log
		{
			"ENTERED": "19.07.2022, 14:22:18",
			"ORDER_STATUS_ID": 1
		}
	],
	"DPD_ORDER_ID": null, //DPD tracking codes
	"OMNIVA_ORDER_ID": null, //Omniva tacking codes
	"VENIPAK_ORDER_ID": null, //Venipack trackig codes
	"delivery_type": null, 
	"EXTERNAL_ID": null, //External id (can be user specified)
	"TOTALS": { //Document total price
		"WO_VAT": 1322.52,
		"VAT": 277.73,
		"W_VAT": 1600.25
	},
	"PAYD": 0, //Payment amount
	"EMAIL": "epasts@kompanija.lv", // email
	"client": {
		"CLIENT_ID": 1, //Client id
		"CLIENT_NAME": "Kompānija SIA", //Client name
		"IS_FIZISKA": false, //Is private person (if false then company)
		"REG_NR": "123123123", //Client registration number
		"PVN_REG_NR": "LV123123123", //Client vat registration number
		"ADDRESS": "Rīga, Rīgas iela 2", //Address
		"LEGAL_ADDRESS": "Rīga, Rīgas iela 2", //Legal address
		"PHONE": "", // Phone
		"EMAIL": "", //Email
		"banks": [ //Client banks
			{
				"bank": {
					"BANK_ID": 18,
					"BANK_CODE": "PARXLV22",
					"BANK_SWIFT_CODE": "PARXLV22",
					"BANK_NAME": "AS Citadele banka"
				},
				"ACCOUNT": "87654321345678900",
				"IS_DEFAULT": "F"
			}
		]
	},
	"payer": null, //Structure the same as client
	"dets": [ //Array of sell docuemnt details
		{
			"SELL_DET_ID": 1,
			"SELL_DOC_ID": 1,
			"ENTERED": "19.07.2022",
			"STOCK_NAME_ID": 57,
			"GOOD_ID": 73,
			"SER_NR_ID": null,
			"STOCK_ID": 83,
			"AMOUNT": 1,
			"TITLE": "Acer Aspire 5 A515-54",
			"MEASURE": "pcs.",
			"SELL_PRICE_WO_DISCOUNT": "495.041300",
			"DISCOUNT": "0.000000",
			"PVN_RATE": 21
		}
	]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86

Insert document

Method : POST
Endpoint /api/sell_doc

FieldTypeRequired
CLIENT_IDInteger, ID
PAYER_IDIngerer, ID
SELL_DATEDate
MUST_PAYDate
ISSUE_DATEDate
STOCK_NAME_IDInteger, ID
DOC_TYPEString
DOC_PAY_TYPEString
CURRENCY_IDInteger, ID
STATUSString
MANAGER_IDInteger, ID
SELL_MANAGER_IDInteger, ID
NOTESString
PIEGADES_ADRESEString
CLIENT_BANK_NAMEString
CLIENT_BANK_CODEString
CLIENT_BANK_ACCOUNTString
ORDER_STATUS_IDInteger, ID

Example

{
	"CLIENT_ID": 1,
	"PAYER_ID": 1, 
	"SELL_DATE": "29.06.2020",
	"MUST_PAY": "29.06.2020",
	"ISSUE_DATE": "29.06.2020",
	"STOCK_NAME_ID": 1,
	"DOC_TYPE": "R",
	"DOC_PAY_TYPE": "B",
	"CURRENCY_ID": 1,
	"STATUS": "0",
	"MANAGER_ID": 0,
	"SELL_MANAGER_ID": 0,
	"NOTES": null,
	"PIEGADES_ADRESE": "Maskavas 1, Riga, LV-1063",
	"CLIENT_BANK_NAME": "Swedbank AS",
	"CLIENT_BANK_CODE": "HABALV22",
	"CLIENT_BANK_ACCOUNT": "LV46HABA0551003384489",
	"ORDER_STATUS_ID": 0
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

Update document

Method : PUT
Endpoint /api/sell_doc/{id}

{
	"CLIENT_ID": 1,
	"PAYER_ID": 1,
	"SELL_DATE": "29.06.2020",
	"MUST_PAY": "29.06.2020",
	"ISSUE_DATE": "29.06.2020",
	"STOCK_NAME_ID": 1,
	"DOC_TYPE": "R",
	"DOC_PAY_TYPE": "B",
	"DOC_SER_NR": "R",
	"DOC_NR": "1",
	"CURRENCY_ID": 1,
	"STATUS": "0",
	"MANAGER_ID": 0,
	"SELL_MANAGER_ID": 0,
	"NOTES": null,
	"PIEGADES_ADRESE": "Maskavas 1, Riga, LV-1063",
	"CLIENT_BANK_NAME": "Swedbank AS",
	"CLIENT_BANK_CODE": "HABALV22",
	"CLIENT_BANK_ACCOUNT": "LV46HABA0551003384489",
	"ORDER_STATUS_ID": 0
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

Document details

Insert detail

Method : POST
Endpoint /api/sell_det

FieldTypeRequired
SELL_DOC_IDInteger, ID
STOCK_NAME_IDInteger, ID
GOOD_IDInteger, ID
SER_NR_IDInteger, ID
STOCK_IDInteger, ID
AMOUNTFloat
TITLEString
MEASUREString
SELL_PRICE_WO_DISCOUNTString
DISCOUNTInteger
PVN_RATEInteger

Example

{
	"SELL_DOC_ID": 1,
	"STOCK_NAME_ID": 1,
	"GOOD_ID": 3347,
	"SER_NR_ID": 0,
	"STOCK_ID": 0,
	"AMOUNT": 1,
	"TITLE": "Zāģripa",
	"MEASURE": "gab.",
	"SELL_PRICE_WO_DISCOUNT": "4.462800",
	"DISCOUNT": "0.000000",
	"PVN_RATE": 21
}
1
2
3
4
5
6
7
8
9
10
11
12
13

Update detail

Method : PUT
Endpoint /api/sell_det/{id}

{
	"SELL_DOC_ID": 1,
	"STOCK_NAME_ID": 1,
	"GOOD_ID": 3347,
	"SER_NR_ID": 0,
	"STOCK_ID": 0,
	"AMOUNT": 1,
	"TITLE": "Zāģripa",
	"MEASURE": "gab.",
	"SELL_PRICE_WO_DISCOUNT": "4.462800",
	"DISCOUNT": "0.000000",
	"PVN_RATE": 21
}
1
2
3
4
5
6
7
8
9
10
11
12
13

Reserve details from stock

Method : POST
Endpoint /api/sell_doc/reserve

FieldTypeRequired
SELL_DOC_IDInteger, ID
reverseInteger

TIP

If product has multiple stock entries, will duplicate the detail

{
	"reserved": [
		//Details that have been successfully reserved
	],
	"not_reserved": [
		//Details that couldn't be reserved
	]
}

1
2
3
4
5
6
7
8
9
Last Updated: 10/3/2023, 2:56:43 PM
Contributors: Daniels