Transfer In From Branch
Transfer In From Branch receives inbound transfer documents into the selected branch. The screen can receive existing transfer lines and can also add new product lines when the user has a Container No. or vehicle plate available for generated batch numbers.
App Entry Points
| App | Target |
|---|---|
| Mobile | TransferInList -> TransferInDetail |
| POS Terminal | transferIn -> TransferInDetailForm |
Main Receive Workflow
Product Add Path
The add-product path exists in both Mobile and Terminal:
- User enters Container No. or vehicle plate.
- App extracts the last four digits.
- App opens product inventory from
getProductBranchContext,syncProductInventory, and local subscription. - Product list is filtered by company and includes dummy products.
- User enters quantity greater than 0.
- App creates a new line with
lineNum: -1,isDel: true, and immediately opens a generated batch draft.
This is different from Transfer Out: Transfer In can add a new received item line; Transfer Out only completes existing outbound transfer lines.
Batch And Date Rules
| Rule | Behavior |
|---|---|
| Container/vehicle requirement | Required before adding new products or generated batches. The last four digits become the batch suffix. |
| Existing transfer line | Batch picker loads lots with getProductLots({ itemCode, whsCode: line.warehouseCode, company }). |
| New added line | Batch is generated from generateBatchCode(getSelectedWhsGrpCode(branch)) plus the entered suffix. |
| Duplicate batch | The same batch number cannot be selected twice on the same line. |
| Quantity | Batch quantity cannot be negative. Product add quantity must be greater than 0. |
| Available lot | If a selected lot reports quantity, batch quantity cannot exceed the lot balance. |
| Existing-line receive | Existing transfer lines may be submitted without received batch rows; when there are no positive batch quantities the payload keeps the original line quantity and sends batchNumbers: []. |
| Zero-batch branch | If a line has batch rows but total batch quantity is 0, the user must confirm; the payload sends the original line quantity and no batch data for that line. |
| Deposit warehouse | When branch.isMain === false, expiry/due date checks use deposit warehouse rules. Deposit due date must be later than the receipt/admission date. |
Submit Payload
Important implementation notes:
refDocNumkeeps the source transfer document number.numAtCardis generated from sourcedocNumplus the current timestamp.- The submitted warehouse code is rebuilt from the selected branch warehouse group; company
NFFDBprefixes non-NF-warehouse codes withNF-. - POS Terminal preserves the source warehouse tab on the list item as
sourceWhsCode, then falls back throughtoWhsCode/branch context when building newly added product lines. receiptDatebecomes the submittedadmissionDateinYYYY-MM-DDTHH:mm:ssformat.transferInDueDatebecomes submitteddueDateonly for deposit warehouse flows, inYYYY-MM-DDTHH:mm:ssformat.
Field Dictionary And Provenance
The source document is loaded with GET /transfers-in?whsCode={selectedWarehouseTab}. The tab is the selected warehouse group and can include an NF- variant. Both apps create this payload for POST /transfer-in.
Header
| Field | Meaning | Source / submit rule |
|---|---|---|
company | Company code | Source transfer API. |
docNum | Source transfer number | Source API; used to build numAtCard and copied to refDocNum. |
docDate, docDueDate, taxDate | Document, due, and tax dates | Source API. |
toWhsCode, comments | Original destination warehouse and comment | Source API. |
numAtCard | Generated receipt reference | ${docNum}_${current timestamp DD-MM-YYYY HH:mm} at submit time. |
refDocNum | Referenced transfer number | Copied from the source docNum. |
branchId, branchCode, branchName | Receiving branch identity | Selected branch first, then document fallback. |
userCode, userName | Receiving user | Current user first, then document fallback. |
payloadBefore | Pre-edit JSON snapshot | Created in the detail screen. |
Lines and batches
| Field | Meaning | Source / submit rule |
|---|---|---|
lineNum, itemCode, itemDescription | Line order and item identity | Source API; new user-added lines use -1. |
grossPrice, grossTotal, unitPrice, lineTotal, vatSum, itemCost, stockValue, discPercent | Price, total, tax, and cost values | Source/new line values, converted to numbers. |
quantity, weight | Received quantity and weight | Batch total when positive; otherwise original line quantity. |
warehouseCode | Receiving warehouse | Rebuilt from selected branch; NFFDB adds NF- when absent. |
warehouseName, vatGroup, grRemarks, costingCode–costingCode5, uomCode, uomEntry | Warehouse name, tax, remarks, cost centers, and unit | Source/product values; uomEntry is numeric. |
batchNumbers[].batchNumber, quantity | Received lot and quantity | Existing lot selection or generated/entered batch on a new line. |
admissionDate | Receipt date | Selected receiptDate, submitted as YYYY-MM-DDTHH:mm:ss. |
manufacturingDate, expiryDate, dueDate | Batch dates | Existing/editor values; dueDate is selected for non-main/deposit flow only and submitted as YYYY-MM-DDTHH:mm:ss. |
Permissions And Guards
| Topic | Behavior |
|---|---|
| Terminal menu key | transferIn |
| deptCode menu set | -2, 1, 2, 3, 4, 7, 29, 21, 8, 9, 12, 22, 27, 28 |
| Branch rule | allowNonMainBranch = true; on a non-main selected warehouse the menu is accessible even when the user's deptCode is not in the stock menu set. |
| Full non-main access | Users with non-main warehouse full access can pass menu access checks across these stock menus. |
| Visibility context | The list is scoped by selected warehouse/context tab. |
Mobile vs POS Terminal
| Topic | Mobile | POS Terminal |
|---|---|---|
| Product inventory | Uses product branch context subscription | Uses the same context/subscription pattern |
| Product add | Opens full-screen picker and quantity modal | Opens modal in split-pane detail |
| Date fields | Receipt date and deposit due date pickers | Receipt date and deposit due date pickers |
| Submit result | Goes back when possible, otherwise replaces list | Refresh list and close detail |
Developer Handoff Map
| Area | Code |
|---|---|
| Mobile detail | apps/mobile/src/screens/transferInStack/transferInDetailScreen/index.tsx |
| Mobile helpers | apps/mobile/src/screens/transferInStack/helpers.ts |
| Terminal detail | apps/pos-terminal/src/screens/HomeScreen/TransferInDetailForm.tsx |
| Mobile service | apps/mobile/src/services/transferIn.ts |
| Terminal service | apps/pos-terminal/src/services/transferIns.ts |
| Product inventory | services/products.ts |