> 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/orders/push/save-a-sale-invoice-against-a-sale-order.md).

# Save a Sale Invoice Against a Sale Order

Bills a **sale order** that is already in Logic ERP. You name the order and, usually, the items and quantities you are delivering now; Logic ERP takes the order's pending lines for those items, with the order's customer, rates and discounts, takes the stock from the branch, works out **GST and other taxes**, and saves a **sale invoice** linked to the order. The order's pending quantity goes down by what was billed, so an order can be billed in parts. The answer tells you the invoice number and Logic ERP's internal number of the invoice.

To bill goods without an order, use [Save a Sale Invoice](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/sale/push/save-a-sale-invoice.md). To bill a delivery order or packing slip, use [Save a Sale Invoice Against a Delivery Order](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/orders/push/save-a-sale-invoice-against-a-delivery-order.md).

### **Endpoint**

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

The response envelope, branches, dates, queueing 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). The order is created with [Save a Sale Order](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/orders/push/save-a-sale-order.md); the saved invoice can be read back with [Get Sale Invoices](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/sale/pull/get-sale-invoices.md).

### **Request fields**

The request has the same shape as [Save a Sale Invoice](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/sale/push/save-a-sale-invoice.md), and most header fields mean the same (see that page). This table lists only what is **different** for an order. Field names are not case-sensitive. Names are looked up without regard to capitals; spaces around them are not trimmed (only `Tax_Region` and `TransporterName` are trimmed). Spaces around the item codes (`LogicUserCode` / `AddlItemCode`) are removed before the item is looked up.

| Field                                                                                                                                                                                                                    | Type         | Required                                                                                   | Default                             | Meaning                                                                                                                                                                                                                                                                                                                                                     |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------ | ------------------------------------------------------------------------------------------ | ----------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Doc_Code`                                                                                                                                                                                                               | number       | Yes (or `OrderNo`)                                                                         | `0`                                 | Logic ERP's internal number of the sale order – the `LastSavedCode` you got from Save a Sale Order.                                                                                                                                                                                                                                                         |
| `OrderNo`                                                                                                                                                                                                                | text         | No                                                                                         | empty                               | With `Doc_Code` `0`: the order of the branch in `BranchCode` (or `BranchShortName`) is looked up by the party order number (`Party_Order_No` sent with Save a Sale Order). When more than one order of the branch has that number, the request is refused – send `Doc_Code`. It is also kept on the invoice as its order number, as on Save a Sale Invoice. |
| `BranchCode`                                                                                                                                                                                                             | number       | No – ignored when `Doc_Code` is sent (standard routine); **required** on the newer routine | `0`                                 | The invoice is always saved in the **order's branch**, with that branch's API settings. Used only for the look-up by `OrderNo`.                                                                                                                                                                                                                             |
| `BranchShortName`                                                                                                                                                                                                        | text         | No                                                                                         | empty                               | Branch short name. Used for the look-up by `OrderNo` when `BranchCode` is `0`.                                                                                                                                                                                                                                                                              |
| `Bill_Date`                                                                                                                                                                                                              | date         | No                                                                                         | today                               | Date of the invoice, `yyyy-MM-dd`; decides the financial year. It does not have to match the order's date.                                                                                                                                                                                                                                                  |
| `BillSeries`                                                                                                                                                                                                             | text         | No                                                                                         | see rules                           | A sale series (not a stock transfer series) of the order's branch, by name. A series linked to the order's series takes priority – see the rules.                                                                                                                                                                                                           |
| `Bill_Number`, `Ext_Bill_No`                                                                                                                                                                                             | number, text | No                                                                                         | `0`, empty                          | As on Save a Sale Invoice.                                                                                                                                                                                                                                                                                                                                  |
| `LstItems`                                                                                                                                                                                                               | list         | No                                                                                         | empty list                          | What to bill now – see the next table. Leave it empty, `null` or out to bill **every pending line of the order** in full.                                                                                                                                                                                                                                   |
| `InvoiceType`                                                                                                                                                                                                            | text         | No                                                                                         | empty                               | `"B2B"` = when the order was taken as a B2B (drop-ship) order, the invoice is made out to the order's other customer and normally posted in the accounts to the order's customer. Any other value: the order's customer.                                                                                                                                    |
| `GST_State_Code`                                                                                                                                                                                                         | text         | No                                                                                         | Logic ERP's value                   | Place-of-supply state code. Used whenever sent – no API setting is needed on this endpoint.                                                                                                                                                                                                                                                                 |
| `Tax_Region`                                                                                                                                                                                                             | text         | No                                                                                         | the default of the series and party | The tax region, by name. `"AUTO"` is not supported.                                                                                                                                                                                                                                                                                                         |
| `ActEntryPartyUserCode`                                                                                                                                                                                                  | text         | No                                                                                         | the order's customer                | A different account to post the invoice to in the accounts, by its code.                                                                                                                                                                                                                                                                                    |
| `AgentName`, `CostCenter`, `Tax_Form_Name`, `TransporterName`, `TransportMode`, `WayBillNo`, `CurrencyName`, `ExchangeRate`, `CreditDays`, `PaymentMode`                                                                 |              | No                                                                                         |                                     | As on Save a Sale Invoice.                                                                                                                                                                                                                                                                                                                                  |
| `CD_P`, `TD_P`, `SpCD_P`, `Freight`, `SpDiscountRs`, `Adjustment_Rs`, `Handling`, `Ext_NetSale_Value`                                                                                                                    | number       | No                                                                                         | `0`                                 | Invoice-level discounts, charges and the net amount check, as on Save a Sale Invoice. Applied over the order's lines.                                                                                                                                                                                                                                       |
| `Remarks1`–`Remarks3`, `DeliveryAt`, `DeliveryAdd1`, `DeliveryAdd2`, `Cases`, `Weight`, `PVTMark`, `GRNo`, `GRDate`, `Challan_No`, `Challan_Date`, `Insurance_Policy_No`, `Declaration_No`, `DeclarationNo`, `OrderDate` |              | No                                                                                         | empty                               | Kept on the invoice, as on Save a Sale Invoice.                                                                                                                                                                                                                                                                                                             |
| `Order_Id`                                                                                                                                                                                                               | text         | No                                                                                         | empty                               | Kept on the invoice – but when the order carries an external order ID, that ID replaces yours.                                                                                                                                                                                                                                                              |
| `TenderDetails`                                                                                                                                                                                                          | list         | No                                                                                         | empty list                          | How the bill was paid, as on Save a Sale Invoice. `[]`, `null` or left out = none.                                                                                                                                                                                                                                                                          |
| `Godown_Name`                                                                                                                                                                                                            | text         | No                                                                                         | empty                               | Not used to choose stock, but a name that does not exist still stops the request. Leave it empty.                                                                                                                                                                                                                                                           |
| `RCU_First_Name`, `RCU_State`                                                                                                                                                                                            | text         | No                                                                                         | empty                               | Used only when the order has no retail customer: without `RCU_Mobile_No` and `RCU_Email`, when both are the same word, the invoice is linked to the one retail customer with that first name in that state.                                                                                                                                                 |
| `Request_ID`, `DisplayError`                                                                                                                                                                                             | text         | No                                                                                         | empty, `"0"`                        | As on Save a Sale Invoice.                                                                                                                                                                                                                                                                                                                                  |

**Ignored fields.** `PartyUserCode` (the invoice is made out to the order's customer), `Doc_Type`, `Token_No`, `STBranchCode`, `EntrySource`, `BillingAddress`, `ShippingAddress` (the order's billing and shipping addresses are used), `Billing_Address1`, `Billing_Address2`, `Sale_BillNo`, `Sale_Bill_Date` (read but not saved) and the other `RCU_…` fields (the order's retail customer is used) are accepted but not used.

**`LstItems` – one entry per item to bill**

| Field                                                                                                                                                                                                 | Type   | Required          | Default | Meaning                                                                                                                      |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ | ----------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------- |
| `LogicUserCode` / `AddlItemCode`                                                                                                                                                                      | text   | Yes (one of them) | empty   | The item, as on Save a Sale Invoice. It must be on the order with a pending quantity.                                        |
| `Quantity`                                                                                                                                                                                            | number | Yes               | –       | Quantity to bill now, above `0`. Lines of the same item are added together.                                                  |
| `Mrp`                                                                                                                                                                                                 | number | No                | `0`     | Above `0`: take the stock only from lots with this MRP.                                                                      |
| `Lot_No`                                                                                                                                                                                              | text   | No                | empty   | Must exist for the item. It decides the lot only when your API site requires a lot number for this endpoint – see the rules. |
| `Rate`, `CD_P`, `TD_P`, `SPCD_P`, `Scheme_Rs`, `SchemePerUnit`, `AdjustItem_Rs`, `AdjustmentRs`, `AdjustmentPerUnit`, `LabourPerUnit`, `ItemDescription`, `GodownName`, `Production_Unit`, `SaleOrSR` |        | No                |         | **Not used** – rates and discounts come from the order (see the rules). `Rate` only appears in a message.                    |

### **Rules Logic ERP applies**

* **Which order.** With `Doc_Code`, that order; it does not have to belong to the branch you send. Without `Doc_Code`, the order of the branch whose party order number equals `OrderNo`; if several orders of the branch have the same number, the request is refused with *More than one Sale Order found for Order No. : … in Branch Code : …..Please send the Sale Order code (Doc\_Code)..*. With neither, the request is refused. The order must be **approved** and not cancelled.
* **Customer and branch come from the order.** The invoice is made out to the order's customer (or, with `"InvoiceType": "B2B"` on a B2B order, to its other customer) and saved in the order's branch. A customer locked for billing, or over its credit limit when Logic ERP stops bills over the limit, is refused.
* **What is billed.** Only order lines with a pending quantity, not cancelled and not linked to another line. With `LstItems`, each item's quantity is spread over the order's pending lines for that item, never more than a line's pending quantity. Every item you send must be on the order, and the quantity billed for each item must come out **exactly** as you sent it – if the order does not have that much pending (**over-billing**) or – when the series checks stock – the branch does not have the stock, the whole request is refused. Without `LstItems`, every pending line is billed in full; when stock cannot fill an item's whole pending quantity, the request is refused and nothing is saved.
* **Partial billing.** Billing less than the pending quantity leaves the rest of the order open; send another request later for the rest. The order is not closed or cancelled after billing.
* **Rates and discounts** come from the order's lines and Logic ERP's settings for the series (the order rate is taken when the series is set to pick rates from the sale order; otherwise the rate Logic ERP's sale bill screen would take). Invoice-level discounts you send are added on top; the schemes set up in Logic ERP are applied, taxes are worked out for the tax region, TCS is added when the customer is set up for it, and the total is rounded, as on the sale bill screen.
* **Stock.** Stock reserved for the order line is used first; otherwise the stock is taken from the branch's lots as Logic ERP's sale bill screen takes it for an order. With `Mrp`, only lots with that MRP. When your API site requires a lot number for this endpoint, only lots with stock are used, limited to the order line's own lot number, or else to the `Lot_No` values you send for that item.
* **Series and number.** The series is, in this order: the sale series your Logic ERP team has linked to the order's series in the API site setup, else the `BillSeries` you send, else the series linked to the customer for sale bills, else the API site's default series for this endpoint. A `BillSeries` that is not found for the order's branch is refused. The invoice gets the next number of that series in the year of `Bill_Date` unless you send `Bill_Number`.
* **Taken over from the order:** the retail customer, billing and shipping addresses, delivery address, the order's external order ID, a credit note adjusted on the order and the advance received against it.
* **API site settings.** This endpoint has its own settings (default series, series links, duplicate order number check, saving in the background or later), separate from Save a Sale Invoice. They are read for the order's branch.
* **Duplicates.** Logic ERP does not stop you billing the same quantities twice as long as the order still has them pending. If your Logic ERP team switches on "do not allow duplicate order number" for this endpoint, `OrderNo` becomes required and a second invoice with the same `OrderNo` for the same branch and customer in the year is refused – which also stops a second partial invoice that repeats the order number.
* **All or nothing.** The invoice, its lines and the reduction of the order's pending quantities are saved together.
* Your Logic ERP team can set the API site to save in the background or keep requests for later processing, as on Save a Sale Invoice. Do not use an apostrophe (`'`) in codes, names or order numbers.
* **Newer save routine.** Some sites are switched by support to a newer routine for this endpoint. On those sites `BranchCode` (or `BranchShortName`), `PartyUserCode` and `LstItems` are required: without a branch the request is refused with `Default Bill Series Not Set for Branch Code : 0` (or, when you send `BillSeries`, `Bill Series : … Not found for Branch Code :0 in API Parameter..`), and without `PartyUserCode` with `Party_User_Code cannot be blank...`. The order must be in the branch you send, belong to `PartyUserCode` (as its customer or its other customer) and be approved, otherwise the request is refused; the invoice is made out to `PartyUserCode` and saved in that branch. The series is `BillSeries` or the API site's default only, the financial year follows `Bill_Date`, and `Order_No` comes back empty. Ask your Logic ERP team which routine your site uses – do not assume the standard one. Sending `BranchCode` and `PartyUserCode` (the order's own branch and customer) works on both.

> **Known issue – a customer marked for stock transfer gets a stock transfer.** If the order's customer is set up in Logic ERP as a stock-transfer party, the document is saved as a stock transfer, not a sale invoice. Check `Invoice_No` and the document in Logic ERP for such customers.

* **Switched off.** When your Logic ERP team has switched this endpoint off for the order's branch, nothing is saved and the answer is `"Status": false` with `Request cannot be processed. API Template is marked as In-Active in the configuration.` in `Message`. Sites on the newer routine answer `"Status": true` with the same sentence. Treat it as "not saved" either way.

### **Example request**

Bill 2 of the 5 shirts and the 1 pair of trousers still pending on sale order 48213:

```json
{
  "Doc_Code": 48213,
  "Bill_Date": "2026-10-29",
  "BillSeries": "WSL",
  "Bill_Number": 0,
  "OrderNo": "WEB-100245",
  "Remarks1": "Part delivery 1",
  "LstItems": [
    {
      "LogicUserCode": "SH-1021-BLK-40",
      "Quantity": 2
    },
    {
      "LogicUserCode": "",
      "AddlItemCode": "8901234567895",
      "Quantity": 1
    }
  ],
  "TenderDetails": []
}
```

### **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. The example's test order may already be fully billed, and is then refused – first save a test order with Save a Sale Order and send its internal number in `Doc_Code`. The sandbox uses the newer save routine, so keep `BranchCode` and `PartyUserCode`.

## Save a Sale Invoice Against a Sale Order

> Bills a sale order that is already in Logic ERP. You name the order and, usually, the items and quantities you are delivering now; Logic ERP takes the order's pending lines for those items, with the order's customer, rates and discounts, takes the stock from the branch, works out GST and other taxes, and saves a sale invoice linked to the order. The order's pending quantity goes down by what was billed, so an order can be billed in parts. The answer tells you the invoice number and Logic ERP's internal number of the invoice.

```json
{"openapi":"3.0.3","info":{"title":"Logic ERP API","version":"1.0"},"tags":[{"name":"Orders - 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":{"/SaveInvoiceAgainstSO":{"post":{"tags":["Orders - Push"],"operationId":"SaveInvoiceAgainstSO","summary":"Save a Sale Invoice Against a Sale Order","description":"Bills a sale order that is already in Logic ERP. You name the order and, usually, the items and quantities you are delivering now; Logic ERP takes the order's pending lines for those items, with the order's customer, rates and discounts, takes the stock from the branch, works out GST and other taxes, and saves a sale invoice linked to the order. The order's pending quantity goes down by what was billed, so an order can be billed in parts. The answer tells you the invoice number and Logic ERP's internal number of the invoice.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"Doc_Code":{"type":"integer","description":"Logic ERP's internal number of the sale order – the `LastSavedCode` you got from Save a Sale Order."},"BranchCode":{"type":"integer","description":"The invoice is always saved in the order's branch, with that branch's API settings. Used only for the look-up by `OrderNo`."},"PartyUserCode":{"type":"string","description":"One party code as shown in Logic ERP (`User_Code` in the response), for example `\"C1045\"`. Returns that party whether or not it changed recently; the bookmark and period are ignored."},"OrderNo":{"type":"string","description":"With `Doc_Code` `0`: the order of the branch in `BranchCode` (or `BranchShortName`) is looked up by the party order number (`Party_Order_No` sent with Save a Sale Order). When more than one order of the branch has that number, the request is refused – send `Doc_Code`. It is also kept on the invoice as its order number, as on Save a Sale Invoice."},"Bill_Date":{"type":"string","description":"Date of the invoice, `yyyy-MM-dd`; decides the financial year. It does not have to match the order's date."},"BillSeries":{"type":"string","description":"A sale series (not a stock transfer series) of the order's branch, by name. A series linked to the order's series takes priority – see the rules."},"Bill_Number":{"type":"integer","description":"As on Save a Sale Invoice."},"Remarks1":{"type":"string","description":"Kept on the invoice, as on Save a Sale Invoice."},"LstItems":{"type":"array","items":{"type":"object","properties":{"LogicUserCode":{"type":"string","description":"The item, as on Save a Sale Invoice. It must be on the order with a pending quantity."},"Quantity":{"type":"integer","description":"Quantity to bill now, above `0`. Lines of the same item are added together."}}},"description":"What to bill now – see the next table. Leave it empty, `null` or out to bill every pending line of the order in full."},"TenderDetails":{"type":"array","items":{"type":"object"},"description":"How the bill was paid, as on Save a Sale Invoice. `[]`, `null` or left out = none."}}}}}},"responses":{"200":{"description":"Always HTTP 200. Check Status and Message.","content":{"application/json":{"schema":{"type":"object","properties":{"PrintFile":{"type":"string","description":"Always empty."},"Invoice_No":{"type":"string","description":"The invoice number given (for a series with its own number format, the formatted number such as `26-27/WSL-1290`), or your `Ext_Bill_No`."},"Order_No":{"type":"string","description":"The sale order's number as Logic ERP shows it – order prefix and number, for example `SO-3554`. Empty when not saved, and always on the newer routine."},"PartyOrderNo":{"type":"string","description":"The `OrderNo` you sent (also when not saved)."},"Status":{"type":"boolean","description":"`true` when the invoice was saved."},"Message":{"type":"string","description":"Empty when saved, unless your Logic ERP shows the document number after saving. The reason when not saved."},"LastSavedCode":{"type":"integer","description":"Logic ERP's internal number of the new invoice; `0` when not saved."},"request_ID":{"type":"string","description":"Filled once Logic ERP has started on the request, also when it then fails."}}}}}},"401":{"description":"No login was sent."}}}}}}
```

### **Response**

| Field           | Meaning for this endpoint                                                                                                                              |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `Status`        | `true` when the invoice was saved.                                                                                                                     |
| `Message`       | Empty when saved, unless your Logic ERP shows the document number after saving. The reason when not saved.                                             |
| `LastSavedCode` | Logic ERP's internal number of the new invoice; `0` when not saved.                                                                                    |
| `Invoice_No`    | The invoice number given (for a series with its own number format, the formatted number such as `26-27/WSL-1290`), or your `Ext_Bill_No`.              |
| `Order_No`      | The sale order's number as Logic ERP shows it – order prefix and number, for example `SO-3554`. Empty when not saved, and always on the newer routine. |
| `PartyOrderNo`  | The `OrderNo` you sent (also when not saved).                                                                                                          |
| `PrintFile`     | Always empty.                                                                                                                                          |
| `request_ID`    | Filled once Logic ERP has started on the request, also when it then fails.                                                                             |

### **Example response**

```json
{
  "PrintFile": "",
  "Invoice_No": "WSL-1290",
  "Order_No": "SO-3554",
  "PartyOrderNo": "WEB-100245",
  "Status": true,
  "Message": "",
  "LastSavedCode": 48377,
  "request_ID": "5d1a7c3e-2b94-4f60-a8e1-0c7b9e3f6a52"
}
```

### **Messages you may see**

All with `Status: false`. With `"DisplayError": "1"`, or when the reason comes from an error inside Logic ERP, the reason may be followed by technical detail – read the first line.

| Message                                                                                                                                                                                                                                                                                                                                                                                                             | Meaning                                                                                                                                                                         | What to do                                                                                |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
| `Unable to Retrieve Sale Order...`                                                                                                                                                                                                                                                                                                                                                                                  | No `Doc_Code`, and `OrderNo` is empty or no order of the branch has it.                                                                                                         | Send `Doc_Code`.                                                                          |
| `More than one Sale Order found for Order No. : … in Branch Code : …..Please send the Sale Order code (Doc_Code)..`                                                                                                                                                                                                                                                                                                 | More than one order of the branch has that party order number.                                                                                                                  | Send `Doc_Code`.                                                                          |
| `Sale Order (Doc_Code : …) belongs to Branch Code : …, not to Branch Code : …..Please Check...`, `Sale Order (Doc_Code : …) does not belong to Party_User_Code : …..Please Check...`                                                                                                                                                                                                                                | Newer routine: the order is not in the branch you sent, or not of the customer you sent.                                                                                        | Send the order's own branch and customer.                                                 |
| `No financial year covers the date …` (date as day/month/year)                                                                                                                                                                                                                                                                                                                                                      | `Bill_Date` lies outside every financial year set up in Logic ERP. Nothing was saved.                                                                                           | Send a date inside a financial year.                                                      |
| `Default Bill Series Not Set for Branch Code : 0`                                                                                                                                                                                                                                                                                                                                                                   | Newer routine: no `BranchCode` was sent.                                                                                                                                        | Send `BranchCode`.                                                                        |
| `Party_User_Code cannot be blank...`                                                                                                                                                                                                                                                                                                                                                                                | Newer routine: no `PartyUserCode` was sent.                                                                                                                                     | Send the order's customer code.                                                           |
| `Doc_Code (Sale Order Code) : … not exists..Please Check...`                                                                                                                                                                                                                                                                                                                                                        | No sale order has that internal number.                                                                                                                                         | Check `Doc_Code`.                                                                         |
| `Sale Order Is marked as Un Approved. Cannot allow Bill Creation :…` (newer routine: `…Bill Creation...`)                                                                                                                                                                                                                                                                                                           | The order is not approved yet.                                                                                                                                                  | Approve the order in Logic ERP first.                                                     |
| `No Pending Item Present against Sale Order..`                                                                                                                                                                                                                                                                                                                                                                      | Nothing is pending on the order – it is fully billed or cancelled – or none of the items you sent is on it.                                                                     | Check the order and the item codes.                                                       |
| A message starting `Unable to found Item Code : … and Rate : …`                                                                                                                                                                                                                                                                                                                                                     | An item you sent is not pending on the order (the rate shown is only what you sent).                                                                                            | Remove the item, or bill it with Save a Sale Invoice.                                     |
| `Unable to Create Bill for Item : … with Quantity : … Order Qty : …`                                                                                                                                                                                                                                                                                                                                                | The quantity you sent for that item could not be billed in full – more than is pending on the order, or not enough stock. The last number is the quantity that could be billed. | Send at most the pending quantity, or check the stock.                                    |
| `Unable to Create Bill for Item : … Quantity : … Billing Qty : …`                                                                                                                                                                                                                                                                                                                                                   | The same check when you bill the whole pending quantity of the order.                                                                                                           | As above.                                                                                 |
| `Unable to Create Bill for Item Code : … Order Pending Qty : … Billing Qty : … (stock not available)..`                                                                                                                                                                                                                                                                                                             | Without `LstItems`: the branch's stock cannot fill the whole pending quantity of that item. Nothing was saved.                                                                  | Check the stock, or send `LstItems` with the quantity you can deliver.                    |
| `Unable to Create Bill because stock not available Item Code : …`                                                                                                                                                                                                                                                                                                                                                   | No stock of that item could be taken.                                                                                                                                           | Check the stock at the order's branch.                                                    |
| A message starting `Stock not available for Item :` (followed by the item's name and codes, and the MRP when you sent one)                                                                                                                                                                                                                                                                                          | No lot of the item has stock at the branch – with that MRP, or among the lot numbers allowed.                                                                                   | Check `Mrp` / `Lot_No` and the stock.                                                     |
| A message starting `Duplicate Entry found for Item :`                                                                                                                                                                                                                                                                                                                                                               | You sent an `Mrp` for an item that appears on more order lines than the MRPs you sent.                                                                                          | Send one `LstItems` entry per MRP, or leave `Mrp` at `0`.                                 |
| `Unable to Retrive Sale Order Item Count : …`                                                                                                                                                                                                                                                                                                                                                                       | No line could be brought in from the order.                                                                                                                                     | Check the order and the stock in Logic ERP.                                               |
| `Unable to found LotNo : … againts EAN/Item Code : …`                                                                                                                                                                                                                                                                                                                                                               | A `Lot_No` does not exist for the item.                                                                                                                                         | Correct or remove `Lot_No`.                                                               |
| `LogicUserCode Or EAN Code Cannot Blank!!`, `Invalid LogicUserCode / EANCode : …`, `Invalid Item Qty : … for Item Code : … EAN Code : …`                                                                                                                                                                                                                                                                            | A line in `LstItems` has no item code, an unknown one, or a quantity of `0` or less.                                                                                            | Correct the line.                                                                         |
| `Invalid Godown Name […]. Please Check...`                                                                                                                                                                                                                                                                                                                                                                          | `Godown_Name` does not exist.                                                                                                                                                   | Leave `Godown_Name` empty.                                                                |
| `Bill Series : … Not found for Branch Code :… in API Parameter..` / `Default Bill Series Not Set for Branch Code :…`                                                                                                                                                                                                                                                                                                | The `BillSeries` you sent is not a sale series of the order's branch, or no series was found for that branch.                                                                   | Send a sale series of that branch, or ask for a series link or default for this endpoint. |
| `Cannot allow Bill Saving If Bill Number defined without Bill Series....`, `Bill No. […] against Branch Code : … already exists...Please Check..`                                                                                                                                                                                                                                                                   | As on Save a Sale Invoice.                                                                                                                                                      | Send both or neither; use a free number.                                                  |
| `Order No. Cannot be blank....` / `Order No. already exists for same Customer.Please Check`                                                                                                                                                                                                                                                                                                                         | The duplicate order number check is on for this endpoint.                                                                                                                       | Send `OrderNo`; for a second partial invoice use a new `OrderNo` with `Doc_Code`.         |
| `Sale Bill Locked against Party(Setup New Accounts)` / `The Above Customer has crossed the Credit Limit....Cannot Continue`                                                                                                                                                                                                                                                                                         | The order's customer is locked for billing or over its credit limit.                                                                                                            | Ask your Logic ERP team.                                                                  |
| `Unable to found Tax Region : …`, `Unable to found A/E Party : …`, `Invalid Agent […] .Please Check`, `Unable to found Cost Center […] .Please Check`, `Invalid Tax Form […] .Please Check`, `Transporter Name [ … ] not found. Please Check...`, `Currency Name : … not found...Please Check...`, `Exchange Rate not Defined for Currency Name :…...Please Check...`, `Card Name [ … ] not found. Please Check...` | A name or code was not found, as on Save a Sale Invoice.                                                                                                                        | Send it exactly as in Logic ERP.                                                          |
| `Net Value cannot match with External Net Value...`                                                                                                                                                                                                                                                                                                                                                                 | Logic ERP's net amount differs from `Ext_NetSale_Value`.                                                                                                                        | Compare with the order's rates; send `0` to skip the check.                               |
| A message from Logic ERP's sale bill checks, for example `Sale Rate is equal to or greater than MRP at Row No.: 1 are same... Cannot allow` or `Day not open for Addition/Modification.........`                                                                                                                                                                                                                    | The bill breaks a rule set up in Logic ERP for sale bills.                                                                                                                      | Correct the order or ask your Logic ERP team.                                             |
| `Request is pending for processing...`                                                                                                                                                                                                                                                                                                                                                                              | Your API site keeps requests for later processing.                                                                                                                              | Keep the `request_ID`.                                                                    |


---

# 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/orders/push/save-a-sale-invoice-against-a-sale-order.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.
