Skip to main content

Stock In/Out

The Stock In/Out Save API allows you to save stock movements (in/out) in the system. It records stock items, quantities, pricing, taxation, and related customer/branch details.

Endpoint

POST /insertStockIO

Purpose

This API:

  • Records stock in/out transactions for a branch
  • Supports item-level stock information including quantities, unit price, and tax amounts
  • Useful for inventory management, reconciliation, and auditing

ℹ️ Each request must include at least the branch ID, stored/released number, registration type, and item list.


Request Object: StockIOSaveReq

FieldDescriptionTypeRequiredLengthNotes
sarNoStored/Released NumberNUMBER✅ Yes38
orgSarNoOriginal Stored/Released NumberNUMBER✅ Yes38
regTyCdRegistration Type CodeCHAR✅ Yes5
custTinCustomer PINCHAR❌ No11Optional
custNmCustomer NameCHAR❌ No100Optional
custBhfIdCustomer Branch IDCHAR❌ No2Optional
sarTyCdStock In/Out Type CodeCHAR✅ Yes5
ocrnDtOccurred DateCHAR✅ Yes8YYYYMMDD
totItemCntTotal Item CountNUMBER✅ Yes10
totTaxblAmtTotal Supply PriceNUMBER✅ Yes18,2
totTaxAmtTotal VATNUMBER✅ Yes18,2
totAmtTotal AmountNUMBER✅ Yes18,2
remarkRemarkCHAR❌ No400Optional
regrIdRegistration IDCHAR✅ Yes20
regrNmRegistration NameCHAR✅ Yes60
modrIdModifier IDCHAR✅ Yes20
modrNmModifier NameCHAR✅ Yes60

Stock Item List (itemList)

FieldDescriptionTypeRequiredNotes
itemSeqItem Sequence NumberNUMBER✅ Yes
itemClsCdItem Class CodeCHAR✅ Yes
itemCdItem CodeCHAR❌ NoOptional
itemNmItem NameCHAR✅ Yes
bcdBarcodeCHAR❌ NoOptional
pkgUnitCdPackage Unit CodeCHAR✅ Yes
pkgPackage QuantityNUMBER✅ Yes
qtyUnitCdQuantity Unit CodeCHAR✅ Yes
qtyUnit QuantityNUMBER✅ Yes
itemExprDtItem Expiration DateCHAR❌ NoYYYYMMDD
prcUnit PriceNUMBER✅ Yes
splyAmtSupply AmountNUMBER✅ Yes
totDcAmtDiscount AmountNUMBER✅ Yes
taxblAmtTaxable AmountNUMBER✅ Yes
taxTyCdTax Type CodeCHAR✅ Yes
taxAmtTax AmountNUMBER✅ Yes
totAmtTotal AmountNUMBER✅ Yes

JSON Request Example

{
"sarNo": 2,
"orgSarNo": 2,
"regTyCd": "M",
"custTin": "A123456789Z",
"custNm": null,
"custBhfId": null,
"sarTyCd": "11",
"ocrnDt": "20260106",
"totItemCnt": 2,
"totTaxblAmt": 70000,
"totTaxAmt": 10677.96,
"totAmt": 70000,
"remark": null,
"regrId": "Test",
"regrNm": "Test",
"modrId": "Test",
"modrNm": "Test",
"itemList": [
{
"itemSeq": 1,
"itemCd": "KE1NTXU0000001",
"itemClsCd": "5059690800",
"itemNm": "test item1",
"bcd": null,
"pkgUnitCd": "NT",
"pkg": 10,
"qtyUnitCd": "U",
"qty": 10,
"itemExprDt": null,
"prc": 3500,
"splyAmt": 35000,
"totDcAmt": 0,
"taxblAmt": 35000,
"taxTyCd": "B",
"taxAmt": 5338.98,
"totAmt": 35000
}
]
}

Response Object: StockIOSaveRes

FieldDescriptionTypeNotes
resultCdResult code (000 = success)CHAR(3)
resultMsgResult messageCHAR
resultDtResponse timestampCHAR(14)YYYYMMDDhhmmss
dataResponse dataObjectNull for this API

JSON Response Example

{
"resultCd": "000",
"resultMsg": "It is succeeded",
"resultDt": "20260211120000",
"data": null
}

SDK Usage Examples

$requestData = [
'sarNo' => 2,
'orgSarNo' => 2,
'regTyCd' => 'M',
'custTin' => 'A123456789Z',
'custNm' => null,
'custBhfId' => null,
'sarTyCd' => '11',
'ocrnDt' => '20260106',
'totItemCnt'=> 2,
'totTaxblAmt'=> 70000,
'totTaxAmt' => 10677.96,
'totAmt' => 70000,
'remark' => null,
'regrId' => 'Test',
'regrNm' => 'Test',
'modrId' => 'Test',
'modrNm' => 'Test',
'itemList' => [
[
'itemSeq' => 1,
'itemCd' => 'KE1NTXU0000001',
'itemClsCd' => '5059690800',
'itemNm' => 'test item1',
'bcd' => null,
'pkgUnitCd' => 'NT',
'pkg' => 10,
'qtyUnitCd' => 'U',
'qty' => 10,
'itemExprDt' => null,
'prc' => 3500,
'splyAmt' => 35000,
'totDcAmt' => 0,
'taxblAmt' => 35000,
'taxTyCd' => 'B',
'taxAmt' => 5338.98,
'totAmt' => 35000
],
[
'itemSeq' => 2,
'itemCd' => 'KE1NTXU0000002',
'itemClsCd' => '5059690800',
'itemNm' => 'test item2',
'bcd' => null,
'pkgUnitCd' => 'BL',
'pkg' => 10,
'qtyUnitCd' => 'U',
'qty' => 10,
'itemExprDt' => null,
'prc' => 3500,
'splyAmt' => 35000,
'totDcAmt' => 0,
'taxblAmt' => 35000,
'taxTyCd' => 'B',
'taxAmt' => 5338.98,
'totAmt' => 35000
]
]
];

$response = $etims->saveStockIO($requestData);

if (($response['resultCd'] ?? '') === '000') {
echo "✅ Stock In/Out saved successfully\n";
} else {
abort("Failed to save Stock In/Out: " . ($response['resultMsg'] ?? 'Unknown error'));
}

Best Practices

  • Validate resultCd before assuming the save succeeded.
  • Include all required fields for both header and itemList.
  • Handle optional customer fields (custTin, custNm, custBhfId) appropriately.
  • Use ocrnDt to indicate the actual stock in/out date.