> For the complete documentation index, see [llms.txt](https://kb.logicerp.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/purchase/push/save-physical-verification-of-a-purchase-voucher.md).

# Save Physical Verification of a Purchase Voucher

Records the **physical verification** of goods received against a **purchase voucher**. When the cartons arrive, the warehouse scans or counts what is actually inside, and Logic ERP keeps that count against each line of the voucher – the same count the **Physical Stock Verification Of PUV** screen (Inventory menu) records. Logic ERP compares it with the billed quantity: anything scanned that is not on the voucher, or more than the voucher quantity, goes into a **difference list**. The count is later used to raise debit notes to the supplier for goods short or for a higher rate charged – see [Generate Rate Difference and Physical Stock Debit Notes](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/purchase/push/generate-rate-difference-and-physical-stock-debit-notes.md). This endpoint creates no new document and does not change stock.

For goods received on a purchase challan, use [Save Physical Verification of a Purchase Challan](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/purchase/push/save-physical-verification-of-a-purchase-challan.md).

### **Endpoint**

| Name          | Detail                                                |
| ------------- | ----------------------------------------------------- |
| Address       | `https://your-server/api/SavePhysicalVerificationPUV` |
| Method        | `POST`                                                |
| Authorization | Basic Auth                                            |

The response and the common messages are explained in [How Every API Call Works](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/how-every-api-call-works.md).

Field names are matched without regard to upper/lower case; fields not listed below are ignored.

### **Request fields**

| Field         | Type   | Required           | Default | Meaning                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| ------------- | ------ | ------------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `DocCode`     | number | One of the two     | `0`     | Logic ERP's internal number of the purchase voucher: `Vouch_Code` in [Get Purchase Vouchers](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/purchase/pull/get-purchase-vouchers.md), or the `LastSavedCode` returned by [Save a Purchase Voucher](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/purchase/push/save-a-purchase-voucher.md). **Recommended.** When it is above `0`, `PUV_Bill_No` is not used and the branch is not checked. The voucher must belong to the current financial year; a number with no lines in that year is refused. |
| `PUV_Bill_No` | text   | One of the two     | empty   | The supplier's bill number as entered on the purchase voucher (`Bill_No` in Get Purchase Vouchers). Used only when `DocCode` is `0`. Only purchase vouchers are searched; a bill number found on more than one voucher is refused – send `DocCode` then.                                                                                                                                                                                                                                                                                                                                                                                         |
| `BranchCode`  | number | With `PUV_Bill_No` | `0`     | The branch of the voucher (`Branch_Code` in [Get Branch Info](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/masters/pull/get-branch-info.md)). There is no branch short name field.                                                                                                                                                                                                                                                                                                                                                                                                              |
| `ListItems`   | list   | **Yes**            | –       | What was scanned or counted, one entry per scan. See the table below. An empty or missing list is refused (also when every entry is skipped as `-1`).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `Doc_Type`    | text   | No                 | –       | **Ignored.** The endpoint decides: this one always works on purchase vouchers.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |

**`ListItems`**

| Field                                             | Type   | Required | Default | Meaning                                                                                                                                                                                                                                                          |
| ------------------------------------------------- | ------ | -------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `LogicUser_Code`                                  | text   | **Yes**  | –       | The code that was scanned. What it must contain depends on how your company counts purchases – see *How the code is read* below. An empty value stops the request. When the API template is set to ignore invalid items, entries whose code is `-1` are skipped. |
| `Quantity`                                        | number | Depends  | `0`     | How many were counted for this code. Used when counting by lot code or by item code (see below). When the configuration counts in packs, the number is multiplied by the units per pack of the matching voucher line.                                            |
| `AddlItemCode`, `Packing_Box_No`, `Item_Det_Code` | –      | No       | –       | **Ignored.** To scan an additional item code, send it in `LogicUser_Code`.                                                                                                                                                                                       |

### **How the code is read**

The API template names a configuration of the **Physical Stock Verification Of PUV** screen; that configuration decides how `LogicUser_Code` is read. Ask your Logic ERP team which one you use. If the voucher has already been counted (on the screen or through this endpoint), the method used for that earlier count is used again, whatever the configuration says.

| Counting method            | `LogicUser_Code` holds                                                                                                                                                                                                                                                                                                                                          | `Quantity`                                                                                                                                                                           |
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Lot code                   | The barcode printed on the lot label.                                                                                                                                                                                                                                                                                                                           | **Send it.** It is the number counted for that barcode; left out, nothing is counted. If the barcode also carries a piece number, that piece number is used as the quantity instead. |
| Lot code with piece number | The barcode of one piece.                                                                                                                                                                                                                                                                                                                                       | Ignored – each barcode counts as one piece. A piece already counted is skipped.                                                                                                      |
| Item code                  | The item code (`UserCode` in [Get Item Master](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/masters/pull/get-item-master.md)), or an additional item code when your company uses them. Upper/lower case must match the item code on the voucher; a code that differs only in case goes to the difference list. | The number counted. A value of `1` or less (or left out) counts as `1`.                                                                                                              |
| Lot number                 | The lot number.                                                                                                                                                                                                                                                                                                                                                 | The lot found is counted, as on the Physical Stock Verification Of PUV screen.                                                                                                       |
| Set code / set name        | The code or name of an item set.                                                                                                                                                                                                                                                                                                                                | Ignored – each item of the set is counted by its quantity in the set. A set that is not found is skipped without a message.                                                          |

If the configuration has a **lot code prefix**, every `LogicUser_Code` must start with it; the prefix is removed before the code is read.

### **Rules Logic ERP applies**

* **Which voucher.** With `DocCode`, that document of the **current financial year** is used; it is not checked to be a purchase voucher, but a number with no lines in the current financial year is refused. With `PUV_Bill_No`, the purchase voucher of the **current financial year** (the year containing today's date on the server) in `BranchCode` with that bill number is used; when more than one voucher has it, the request is refused.
* **Configuration required.** The API template must name a default configuration for this screen, otherwise nothing is saved.
* **Counts add up.** Each request **adds** to what has already been counted for the voucher. Send each scan once; sending the same request twice counts the goods twice.
* **Matching.** A scan is set against the voucher line with the same lot (or item) that still has quantity left. Codes not on the voucher, and quantities beyond the voucher quantity, go to the difference list.
* **Unknown codes.** If the configuration does not allow invalid items and counting is by item code, a code that is not an item in Logic ERP stops the request.
* **When the count is refused.** Nothing is saved if the voucher has already been used in a debit note for physical stock difference, or linked in the Receipt Register; if the configuration requires a minimum percentage to be scanned and less was scanned (counting every request so far); or if the configuration requires every voucher line to be scanned and a line still has nothing counted – the answer then names those items. The answer is `Status: false` with the reason.
* **Configurations the API cannot use.** Counting by packing box, and the option that copies the voucher quantity into the physical quantity, are refused.
* **All or nothing.** The counts for all lines and the difference list are saved together. If any scan is refused, nothing from the request is saved.

> **Known issue – missing voucher answered as success.** If `DocCode` is `0` and `PUV_Bill_No` is empty, the answer is `Status: true` with the message `Invalid Bill No. Please Check...`, and nothing is saved. Always send `DocCode` or `PUV_Bill_No`.

### **Example request**

Counting by item code:

```json
{
  "BranchCode": 2,
  "DocCode": 4512,
  "ListItems": [
    {
      "LogicUser_Code": "8901234500017",
      "Quantity": 12
    },
    {
      "LogicUser_Code": "8901234500024",
      "Quantity": 6
    }
  ]
}
```

### **Test it**

Send a request to the Logic ERP **sandbox** (a test company) from this page: open the block below, enter the sandbox user name and password (ask your Logic ERP support team), change the request if you like, and press **Test it**. This really saves in the sandbox, so use test values like the example. The example counts the sandbox's test voucher; counts add up, so each send counts again.

## Save Physical Verification of a Purchase Voucher

> Records the physical verification of goods received against a purchase voucher. When the cartons arrive, the warehouse scans or counts what is actually inside, and Logic ERP keeps that count against each line of the voucher – the same count the Physical Stock Verification Of PUV screen (Inventory menu) records. Logic ERP compares it with the billed quantity: anything scanned that is not on the voucher, or more than the voucher quantity, goes into a difference list. The count is later used to raise debit notes to the supplier for goods short or for a higher rate charged – see Generate Rate Difference and Physical Stock Debit Notes. This endpoint creates no new document and does not change stock.

```json
{"openapi":"3.0.3","info":{"title":"Logic ERP API","version":"1.0"},"tags":[{"name":"Purchase - Push"}],"servers":[{"url":"https://demo.logicerp.com/api","description":"Logic ERP sandbox (test company)"}],"security":[{"basicAuth":[]}],"components":{"securitySchemes":{"basicAuth":{"type":"http","scheme":"basic","description":"The user name and password of your API site."}}},"paths":{"/SavePhysicalVerificationPUV":{"post":{"tags":["Purchase - Push"],"operationId":"SavePhysicalVerificationPUV","summary":"Save Physical Verification of a Purchase Voucher","description":"Records the physical verification of goods received against a purchase voucher. When the cartons arrive, the warehouse scans or counts what is actually inside, and Logic ERP keeps that count against each line of the voucher – the same count the Physical Stock Verification Of PUV screen (Inventory menu) records. Logic ERP compares it with the billed quantity: anything scanned that is not on the voucher, or more than the voucher quantity, goes into a difference list. The count is later used to raise debit notes to the supplier for goods short or for a higher rate charged – see Generate Rate Difference and Physical Stock Debit Notes. This endpoint creates no new document and does not change stock.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"BranchCode":{"type":"integer","description":"The branch of the voucher (`Branch_Code` in Get Branch Info). There is no branch short name field."},"DocCode":{"type":"integer","description":"Logic ERP's internal number of the purchase voucher: `Vouch_Code` in Get Purchase Vouchers, or the `LastSavedCode` returned by Save a Purchase Voucher. Recommended. When it is above `0`, `PUV_Bill_No` is not used and the branch is not checked. The voucher must belong to the current financial year; a number with no lines in that year is refused."},"ListItems":{"type":"array","items":{"type":"object","properties":{"LogicUser_Code":{"type":"string","description":"The code that was scanned. What it must contain depends on how your company counts purchases – see How the code is read below. An empty value stops the request. When the API template is set to ignore invalid items, entries whose code is `-1` are skipped."},"Quantity":{"type":"integer","description":"How many were counted for this code. Used when counting by lot code or by item code (see below). When the configuration counts in packs, the number is multiplied by the units per pack of the matching voucher line."}}},"description":"What was scanned or counted, one entry per scan. See the table below. An empty or missing list is refused (also when every entry is skipped as `-1`)."}}}}}},"responses":{"200":{"description":"Always HTTP 200. Check Status and Message.","content":{"application/json":{"schema":{"type":"object","properties":{"Status":{"type":"boolean","description":"`true` when the count was saved. Read this field, not `Message` (see the known issues)."},"Message":{"type":"string","description":"`\"Physical Varification Done...\"` when saved; otherwise the reason."},"LastSavedCode":{"type":"integer","description":"Always `0`."},"request_ID":{"type":"string","description":"Always empty for this endpoint."}}}}}},"401":{"description":"No login was sent."}}}}}}
```

### **Response**

| Field           | Type         | Meaning                                                                                 |
| --------------- | ------------ | --------------------------------------------------------------------------------------- |
| `Status`        | true / false | `true` when the count was saved. Read this field, not `Message` (see the known issues). |
| `Message`       | text         | `"Physical Varification Done..."` when saved; otherwise the reason.                     |
| `LastSavedCode` | number       | Always `0`.                                                                             |
| `request_ID`    | text         | Always empty for this endpoint.                                                         |

### **Example response**

```json
{
  "Status": true,
  "Message": "Physical Varification Done...",
  "LastSavedCode": 0,
  "request_ID": ""
}
```

### **Messages you may see**

| Message                                                                                                                                                                                                                       | Meaning                                                                                                                                                                            | What to do                                                         |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ |
| `No Purchase Voucher Selected`                                                                                                                                                                                                | No purchase voucher found for `PUV_Bill_No` in the branch and current financial year (not used for `DocCode`).                                                                     | Check the number and `BranchCode`, or send `DocCode`.              |
| `Bill No. : … found multiple times. Please send DocCode...`                                                                                                                                                                   | More than one purchase voucher of the branch and year has that bill number.                                                                                                        | Send `DocCode`.                                                    |
| `No items found against DocCode : … in the current financial year...`                                                                                                                                                         | `DocCode` has no lines in the current financial year.                                                                                                                              | Take `DocCode` from Get Purchase Vouchers for the current year.    |
| `No items to verify (ListItems is empty)...`                                                                                                                                                                                  | `ListItems` is empty or missing, or every entry was skipped.                                                                                                                       | Send at least one scan.                                            |
| `Invalid Bill No. Please Check...` (with `Status: true`)                                                                                                                                                                      | Neither `DocCode` nor `PUV_Bill_No` was sent. Nothing was saved.                                                                                                                   | Send one of them.                                                  |
| `Default Configuration Not Selected...`                                                                                                                                                                                       | The API template has no configuration for this screen.                                                                                                                             | Ask your Logic ERP team to set it.                                 |
| `Cannot Allow Box No Scanning. Please check Physical Verification Of PUV Config...`                                                                                                                                           | The configuration counts by packing box.                                                                                                                                           | Use a configuration without box scanning.                          |
| `Cannot Move Voucher Quantity to Physical Quantity. Please check Physical Verification Of PUV Config...`                                                                                                                      | The configuration copies the voucher quantity into the count.                                                                                                                      | Use a configuration without that option.                           |
| `Barcode cannot be blank`                                                                                                                                                                                                     | An entry has an empty `LogicUser_Code`.                                                                                                                                            | Send a code in every entry.                                        |
| `Invalid Item Code..`                                                                                                                                                                                                         | The code does not start with the configured lot code prefix.                                                                                                                       | Send the full code as printed.                                     |
| `Invalid Item Code.....: …`                                                                                                                                                                                                   | The item code does not exist in Logic ERP (item-code counting with invalid items not allowed).                                                                                     | Check the code.                                                    |
| `Invalid Barcode...(…)`                                                                                                                                                                                                       | Piece counting: the barcode is not a lot-and-piece barcode.                                                                                                                        | Scan the piece label.                                              |
| `Lot Number does not exists` / `More than one Item exists against Lot`                                                                                                                                                        | Lot-number counting: the lot number was not found, or belongs to several items.                                                                                                    | Check the lot number.                                              |
| `This Purchase Voucher has been Retrieved in Purchase Return(Debit Note) for Physical Stock Difference.... Cannot Allow Change...`, `This Purchase Voucher has been Retrieved in Receipt Register.... Cannot Allow Change...` | The voucher is already used in a physical-stock debit note or in the Receipt Register. Nothing was saved.                                                                          | Check the voucher on the screen.                                   |
| `You must Scan minimum … (%) Physical Stock to Continue.....`                                                                                                                                                                 | Less than the configured percentage has been scanned so far. Nothing was saved.                                                                                                    | Scan the rest and send it.                                         |
| `Physical Scaning not exists against following items :- …`                                                                                                                                                                    | The configuration requires every voucher line to be scanned, and some lines have nothing counted yet; the item and pack of each such line follow, one per line. Nothing was saved. | Scan those items and send them, or record the count on the screen. |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/purchase/push/save-physical-verification-of-a-purchase-voucher.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
