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

Save a Purchase Voucher Against a Delivery Note

Meant to bill a supplier's delivery note that is already in Logic ERP as a purchase voucher. A delivery note records goods a supplier is sending against a purchase order; this endpoint is meant to take the delivery note's pending lines, save them as a purchase voucher posted to the delivery note's supplier, and record any quantity you did not receive as a shortage. You send the delivery note's internal number and the items and quantities you received.

Known issue – the voucher is not saved. In the current version this endpoint does not load the delivery note's lines into the voucher, so a request that passes the first checks is refused – most likely with No items present in bill.... – and nothing is saved. Until this is fixed, bill delivery notes in Logic ERP, or record the receipt with Save a Purchase Voucher Against a Purchase Order using the delivery note's purchase order.

To record a purchase without a delivery note or order, use Save a Purchase Voucher. To find delivery notes, use Get Delivery Notes.

Endpoint

Name
Detail

Address

https://your-server/api/SavePurchaseAgainstDN

Method

POST

Authorization

Basic Auth

The response envelope, branches, dates, queueing and the common messages are explained in How Every API Call Works.

Request fields

This endpoint has its own, short request – it is not the Save a Purchase Voucher request. Field names are not case-sensitive.

Field
Type
Required
Default
Meaning

DNO_Code

number

Yes

0

Logic ERP's internal number of the delivery note (Doc_Code in Get Delivery Notes). The supplier and the branch of the voucher are the delivery note's.

Bill_No

text

No

empty

The supplier's bill (invoice) number. Replaced by the delivery note's invoice number when it has one.

Bill_Date

date

No

today

The supplier's bill date, yyyy-MM-dd. Replaced by the delivery note's invoice date when it has an invoice number and date.

PU_Remarks_1, PU_Remarks_2, PU_Remarks_3

text

No

empty

Remarks 1 to 3 of the voucher.

LstItems

list

No

empty list

The items and quantities you received – see below. It is used only to work out shortages; an item of the delivery note that is not listed counts as not received.

DisplayError

text

No

"0"

"1" = when the request fails, Message holds the full technical detail. Use only while testing.

LstItems – one entry per item received

Field
Type
Required
Default
Meaning

LogicUser_Code

text

Yes, for the entry to count

empty

The item code shown in Logic ERP (UserCode in Get Item Master). It is not checked; it is matched to the delivery note's items exactly as sent, including capital letters.

ScannedQty

number

Yes

0

Quantity received. An item of the delivery note received short – or not listed – is meant to be recorded as a shortage (see the rules).

Ignored fields. BranchCode (the delivery note's branch is always used), GRN_Prefix and GRN_Number (the purchase series decides the GRN number), Doc_Type (always a purchase), Challan_Code, PO_Code, DocCode, and in LstItems: AddlItemCode and Lot_Mrp. The fields of Save a Purchase Voucher that are not listed above (for example AccountCode, InvoiceDate, Godown_Name) are not part of this request and are ignored.

Rules Logic ERP applies

These are the checks the endpoint makes before the step that currently fails (see the known issue above).

  • Delivery note. It must have a pending quantity; otherwise the request is refused with No Pending Quanity exists against Delivery Note... (also when DNO_Code is wrong or missing).

  • Series. The voucher is saved in a purchase series chosen in your API site's settings for Purchase against DNO: the series linked to the purchase order's prefix, else the Default Purchase Configuration. There is no request field for the series.

  • Values from the delivery note. The supplier, the branch, the transport GR (lorry receipt) number and date, the challan number and date, the invoice number and date (as the supplier's bill) and the credit days.

  • Questions. The voucher is saved as on Logic ERP's purchase screen: its confirmation and the question about saving without TDS details are answered Yes; any other message from the screen stops the request and comes back as Message.

  • Shortages. When your API site's settings ask for it, after the voucher is saved a shortage document is created for every item of the delivery note whose pending quantity is more than ScannedQty (or which is not in LstItems).

  • Your Logic ERP licence must include the API for purchase orders and delivery notes.

Example request

Response

Field
Type
Meaning

Status

true / false

true when the voucher was saved.

Message

text

The reason when not saved.

LastSavedCode

number

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

request_ID

text

The ID of this request – quote it to support. null when the request was refused by the first checks (series, pending quantity).

There is no LastSavedDocNo in this response.

Example response

What the endpoint returns today for a delivery note with pending quantity:

Messages you may see

Message
Meaning
What to do

Default Purchase Configuration not found.....

No purchase series is chosen for purchase against delivery notes in your API site's settings.

Ask your Logic ERP team to choose the Default Purchase Configuration.

No Pending Quanity exists against Delivery Note...

The delivery note has nothing pending, or DNO_Code is wrong or missing.

Check DNO_Code (Get Delivery Notes).

No items present in bill.... (or another message from the purchase screen)

The voucher could not be built – see the known issue. Nothing was saved.

Bill the delivery note in Logic ERP.