For the complete documentation index, see llms.txt. This page is also available as Markdown.

Save a Sale Invoice Against a Delivery Order

Bills a delivery order or packing slip that is already in Logic ERP. A delivery order (or packing slip) sets aside the goods to be dispatched – items, lots, godowns and quantities – but posts nothing to the customer's account. This endpoint takes the lines of that document that are not billed yet, prices and taxes them, and saves them as a sale invoice made out to its customer. You send the document's internal number; you do not send the items.

To bill straight from a sale order, use Save a Sale Invoice Against a Sale Order. To bill goods without an order, use Save a Sale Invoice.

Endpoint

Name
Detail

Address

https://your-server/api/SaveInvoiceAgainstDO

Method

POST

Authorization

Basic Auth

The response envelope, branches, dates, queueing and the common messages are explained in How Every API Call Works. Delivery orders are made in Logic ERP itself; their stock is assigned there or with Assign Stock to a Delivery Order. Packing slips are saved with Save a Packing Slip Against a Sale Order or Save a Packing Slip Allowing Items Outside the Sale Order, or in Logic ERP.

Request fields

The request has the same shape as Save a Sale Invoice, and most header fields mean the same (see that page). This table lists only what is different. 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).

Field
Type
Required
Default
Meaning

Doc_Code

number

Yes (or OrderNo) – see the known issue

0

Logic ERP's internal number of the delivery order or packing slip – the LastSavedCode you got when it was saved.

OrderNo

text

No

empty

With Doc_Code 0: Logic ERP looks for a delivery order of the branch in BranchCode that still has something to bill and was made from a sale order whose party order number (Party_Order_No of Save a Sale Order) equals OrderNo. Packing slips are not found this way. It is also kept on the invoice as its order number. When the duplicate order number check is on for this endpoint, OrderNo is required even with Doc_Code.

BranchCode

number

No – ignored once the document is found

0

The invoice is always saved in the document's branch, with that branch's API settings. Used only for the look-up by OrderNo.

Bill_Date

date

No

today

Date of the invoice, yyyy-MM-dd; decides the financial year.

BillSeries

text

No

see rules

A sale series (not a stock transfer series) of the document's branch, by name.

Bill_Number, Ext_Bill_No

number, text

No

0, empty

As on Save a Sale Invoice.

LstItems

list

No

empty list

Normally not used – every open line is billed. Only when the bill series is set up in Logic ERP to choose items while bringing in a delivery order, the lines of the items you list are billed (in their full open quantity) and the others are left open. Each line you send is still checked (item code, quantity above 0, lot number exists for the item), and a wrong one stops the request.

BillingAddress, ShippingAddress

object

No

none

Billing and shipping address of the invoice, as on Save a Sale Invoice. See the known issue.

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 document'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.

Remarks1–Remarks3, DeliveryAt, DeliveryAdd1, DeliveryAdd2, Cases, Weight, PVTMark, GRNo, GRDate, Challan_No, Challan_Date, Insurance_Policy_No, Declaration_No, DeclarationNo, OrderDate, Order_Id

No

empty

Kept on the invoice, as on Save a Sale Invoice.

TenderDetails

list

No

empty list

How the bill was paid, as on Save a Sale Invoice. Send [] or leave it out – never null.

Godown_Name

text

No

empty

Not used – the lines keep the document's godowns – but a name that does not exist still stops the request. Leave it empty.

RCU_First_Name, RCU_State

text

No

empty

Used only in one case: 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. Otherwise no retail customer is created or looked up.

Request_ID, DisplayError

text

No

empty, "0"

As on Save a Sale Invoice.

Ignored fields. PartyUserCode (the invoice is made out to the document's customer), BranchShortName once the document is found, Doc_Type, Token_No, STBranchCode, InvoiceType, EntrySource, Billing_Address1, Billing_Address2, Sale_BillNo, Sale_Bill_Date (read but not saved), the other RCU_… fields, and in LstItems the quantity, rate, MRP, discounts, description and godown of each line are accepted but not used.

Rules Logic ERP applies

  • What can be billed. Delivery orders made from a sale order (only the goods whose stock has been assigned to the delivery order), and packing slips (with or without a sale order). The document must be approved. Every line with an open quantity is billed – with the document's items, lots, godowns and open quantities; filters set on the bill series in Logic ERP (godowns the series and the API user may use, default companies, party item groups) can leave some lines out. You cannot change the quantities or bill only part of a line.

  • Customer and branch come from the document. The invoice is made out to the delivery order's customer and saved in its branch; PartyUserCode is ignored. A customer locked for billing, or over its credit limit when Logic ERP stops bills over the limit, is refused.

  • Rates and taxes. Each line gets the rate Logic ERP's sale bill screen takes for the series; when the series is set to take the rate, the discounts or both from the sale order, those of the sale order line behind the delivery order line are used. Invoice-level discounts you send are added on top. Logic ERP applies its schemes, works out GST and other taxes for the tax region, adds TCS when the customer is set up for it and rounds the total, as on the sale bill screen.

  • Stock was set aside by the delivery order or packing slip; the invoice uses those lots and godowns.

  • After billing the billed quantities are no longer open on the delivery order or packing slip. A line that has been billed is not billed again, so sending the same Doc_Code twice does not bill the lines twice; the second request finds nothing left to bill.

  • Series and number. The series is, in this order: the sale series your Logic ERP team has linked in the API site setup to the document's prefix, 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 is skipped without a message. The invoice gets the next number of that series in the year of Bill_Date unless you send Bill_Number.

  • 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, read for the document's branch.

  • Duplicates of OrderNo. 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.

  • All or nothing. The invoice and all its lines are saved together. If anything fails, nothing is saved.

  • 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. This endpoint always uses the standard save routine (there is no newer routine for it). Do not use an apostrophe (') in codes, names or order numbers.

Known issue – without Doc_Code or OrderNo an unrelated delivery order can be billed. When both are left out, Logic ERP looks for an open delivery order of the branch in BranchCode (or, with BranchCode 0, one saved without a branch) whose sale order has no party order number, and bills the first one it finds. Always send Doc_Code.

Known issue – "ShippingAddress": null makes the call fail, and the shipping address is dropped without a billing address. As on Save a Sale Invoice: sending ShippingAddress as null while BillingAddress is present fails with a technical error, and a ShippingAddress sent with "BillingAddress": null is not saved. Leave out an address you do not have, or send it with empty values.

Known issue – a customer marked for stock transfer gets a stock transfer. If the document'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.

Known issue – a wrong BillSeries is not refused. A series name that does not exist for the document's branch is skipped and the invoice is saved in another series without a message. Check Invoice_No in the response.

Known issue – WayBillNo is not linked. As on Save a Sale Invoice: a way bill that is not finalized is refused as already Finalized, and a finalized one is accepted but not linked. Leave WayBillNo empty.

Known issue – the request status loses the invoice number. When your API site saves this endpoint in the background, asking for the result with TokenStatus returns only Status, Message, LastSavedCode and request_ID – not Invoice_No, Order_No or PartyOrderNo. Read the invoice with Get Sale Invoices using LastSavedCode.

Known issue – a switched-off endpoint answers "Status": false with technical text. When your Logic ERP team has switched this endpoint off for the document's branch, nothing is saved and Message holds technical detail around Request cannot be processed. API Template is marked as In-Active in the configuration. Treat it as "not saved".

Example request

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 packing slip is already billed, so the example is refused – first save a test packing slip with Save a Packing Slip Against a Sale Order and send its internal number in Doc_Code.

Save a Sale Invoice Against a Delivery Order

post

Bills a delivery order or packing slip that is already in Logic ERP. A delivery order (or packing slip) sets aside the goods to be dispatched – items, lots, godowns and quantities – but posts nothing to the customer's account. This endpoint takes the lines of that document that are not billed yet, prices and taxes them, and saves them as a sale invoice made out to its customer. You send the document's internal number; you do not send the items.

Authorizations
AuthorizationstringRequired

The user name and password of your API site.

Body
Doc_CodeintegerOptional

Logic ERP's internal number of the delivery order or packing slip – the LastSavedCode you got when it was saved.

OrderNostringOptional

With Doc_Code 0: Logic ERP looks for a delivery order of the branch in BranchCode that still has something to bill and was made from a sale order whose party order number (Party_Order_No of Save a Sale Order) equals OrderNo. Packing slips are not found this way. It is also kept on the invoice as its order number. When the duplicate order number check is on for this endpoint, OrderNo is required even with Doc_Code.

Bill_DatestringOptional

Date of the invoice, yyyy-MM-dd; decides the financial year.

Bill_NumberintegerOptional

As on Save a Sale Invoice.

Remarks1stringOptional

Kept on the invoice, as on Save a Sale Invoice.

LstItemsobject[]Optional

Normally not used – every open line is billed. Only when the bill series is set up in Logic ERP to choose items while bringing in a delivery order, the lines of the items you list are billed (in their full open quantity) and the others are left open. Each line you send is still checked (item code, quantity above 0, lot number exists for the item), and a wrong one stops the request.

TenderDetailsobject[]Optional

How the bill was paid, as on Save a Sale Invoice. Send [] or leave it out – never null.

Responses
200

Always HTTP 200. Check Status and Message.

application/json
PrintFilestringOptional

Always empty.

Invoice_NostringOptional

The invoice number given, or your Ext_Bill_No.

Order_NostringOptional

The delivery order's or packing slip's number – its prefix and number, for example DO-118. Empty when not saved.

PartyOrderNostringOptional

The OrderNo you sent (also when not saved).

StatusbooleanOptional

true when the invoice was saved.

MessagestringOptional

Empty when saved, unless your Logic ERP shows the document number after saving. It can then also carry notes from follow-up steps, for example Export Virtual Txns : Branch/Supplier STI Settings Not Found..., while Status is still true – go by Status and LastSavedCode, not by the text. The reason when not saved.

LastSavedCodeintegerOptional

Logic ERP's internal number of the new invoice; 0 when not saved.

request_IDstringOptional

Filled once Logic ERP has started on the request, also when it then fails.

post/SaveInvoiceAgainstDO
POST /api/SaveInvoiceAgainstDO HTTP/1.1
Host: demo.logicerp.com
Authorization: Basic username:password
Content-Type: application/json
Accept: */*
Content-Length: 140

{
  "Doc_Code": 5354,
  "OrderNo": "APITEST-SO-001",
  "Bill_Date": "2026-10-30",
  "Bill_Number": 0,
  "Remarks1": "API TEST",
  "LstItems": [],
  "TenderDetails": []
}
{
  "PrintFile": "text",
  "Invoice_No": "text",
  "Order_No": "text",
  "PartyOrderNo": "text",
  "Status": true,
  "Message": "text",
  "LastSavedCode": 1,
  "request_ID": "text"
}

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. It can then also carry notes from follow-up steps, for example Export Virtual Txns : Branch/Supplier STI Settings Not Found..., while Status is still true – go by Status and LastSavedCode, not by the text. 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, or your Ext_Bill_No.

Order_No

The delivery order's or packing slip's number – its prefix and number, for example DO-118. Empty when not saved.

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

Messages you may see

All with Status: false. When your API site logs requests, or with "DisplayError": "1", the reason may be followed by technical detail – read the first line.

Message
Meaning
What to do

Unable to Retrieve Delivery Order...

No Doc_Code, and no open delivery order was found for OrderNo in that branch.

Send Doc_Code.

Doc_Code (Delivery Order Code) : … not exists..Please Check...

No delivery order or packing slip has that internal number.

Check Doc_Code.

Delivery Order Is marked as Un Approved. Cannot allow Bill Creation :…

The document is not approved yet.

Approve it in Logic ERP first.

"Status": false with No Items present...., another message from Logic ERP, or an empty Message

Nothing is left to bill – the lines are billed already, or none of the items you listed (with item selection on) is open.

Check the document in Logic ERP.

LogicUserCode Or EAN Code Cannot Blank!!, Invalid LogicUserCode / EANCode : …, Invalid Item Qty : … for Item Code : … EAN Code : …, Unable to found LotNo : … againts EAN/Item Code : …

A line in LstItems is wrong.

Leave LstItems empty unless you use item selection.

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 :…

No series was found for the document's branch.

Send a sale series of that branch, or ask for a default series 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, a new one for each invoice.

Sale Bill Locked against Party(Setup New Accounts) / The Above Customer has crossed the Credit Limit....Cannot Continue

The 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.

Way Bill No. :… not found In Branch Code : … or Way Bill No. :… is already Finalized..Please Check

See the known issue on WayBillNo.

Leave WayBillNo empty.

Net Value cannot match with External Net Value...

Logic ERP's net amount differs from Ext_NetSale_Value.

Check the document's rates; send 0 to skip the check.

A message from Logic ERP's sale bill checks, for example Day not open for Addition/Modification.........

The bill breaks a rule set up in Logic ERP for sale bills.

Correct the request, or ask your Logic ERP team.

Request is pending for processing...

Your API site keeps requests for later processing.

Keep the request_ID.

Last updated