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

Generate Rate Difference and Physical Stock Debit Notes

Creates the debit notes to the supplier that are due on one purchase voucher – the same job as the Generate Rate Diff/Phy Stock Debit Notes screen (Purchase menu) does for a single voucher. You send the voucher's bill number; Logic ERP works out what is pending and saves up to three documents:

  • Rate difference debit note – when the supplier charged more than the rate agreed on the purchase order. These lines are marked for a debit note when the purchase is saved against the order and the rate charged is above the order rate. The debit note charges the difference per unit for the quantity that has been physically verified and not yet debited. Saved as a Purchase Return – Rate Difference document.

  • Physical stock debit note – when the physical verification found less than was billed. For each line counted short, it returns the missing quantity (billed minus counted) at the rate on the purchase voucher. Saved as a purchase return; made only once per voucher.

  • Rejection / shortage debit note – for rejected or short quantities still pending, as entered on Enter Rejection/Replacements Items against Purchase. Saved as a purchase return.

The physical count comes from Save Physical Verification of a Purchase Voucher or the screen – without it no rate difference or physical stock debit note is made.

Endpoint

Name
Detail

Address

https://your-server/api/SaveRateDiffDebitNotesAgainstPU

Method

POST

Authorization

Basic Auth

Also accepted: https://your-server/api/SaveRateDiffDebitNotesAgaintPU (older spelling, same behaviour).

The response and the common messages are explained in How Every API Call Works.

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

Request fields

Field
Type
Required
Default
Meaning

BranchCode

number

Yes

0

The branch of the purchase voucher (Branch_Code in Get Branch Info).

Bill_No

text

Yes

–

The supplier's bill number as entered on the purchase voucher (Bill_No in Get Purchase Vouchers). Must match the bill number on the voucher.

GRN_Prefix

text

No

empty

The voucher's GRN prefix (GRN_Prefix in Get Purchase Vouchers). Send it with GRN_Number when the bill number is used on more than one document.

GRN_Number

number

With GRN_Prefix

0

The voucher's GRN number (GRN_Number in Get Purchase Vouchers). Used only when above 0, and then together with GRN_Prefix – sent without a prefix, only vouchers with a blank GRN prefix are matched.

BranchShortName

text

No

–

Ignored. Send BranchCode.

Rules Logic ERP applies

  • Which voucher. Logic ERP looks in the branch and the current financial year (the year containing today's date on the server) for documents with this Bill_No – and this GRN_Prefix / GRN_Number when sent. Exactly one must be found; the search covers purchase returns and other purchase documents too, so add the GRN prefix and number when the bill number repeats.

  • Only purchase vouchers. The document found must be a purchase voucher that is not marked goods-in-transit. Stock transfers in are skipped unless your Logic ERP team has allowed debit notes for stock transfers. See the known issue below for what happens otherwise.

  • Configuration required. The Generate Rate Diff/Phy Stock Debit Notes configuration must name the series and prefix for rate-difference debit notes and the series and prefix for physical stock debit notes – both, even if you only need one kind. For rejection debit notes it uses its own series and prefix if set, otherwise the rate-difference series and the prefix PR.

  • Nothing pending. If the voucher has no pending rate difference, no short count without a debit note, and no pending rejection or shortage, nothing is created and the reason is returned.

  • Rate difference needs a count. A line with a rate difference gets a debit note only for the quantity physically verified beyond what has already been debited. Lines not yet counted are left for later.

  • Vouchers that do not add stock. For a voucher saved without adding stock, only the rate-difference debit note is made, from the physical count, and only when the pending amount is above ₹10.

  • Numbering and date. Each debit note gets the next number of its prefix in the branch and the date of the purchase voucher.

  • Each debit note is saved on its own. If a later one fails, those already made stay saved and the answer is Status: false. Check the voucher on the screen before sending again; a repeat only creates what is still pending.

Known issue – only the last debit note is reported. When more than one debit note is made, LastSavedCode and LastSavedDocNo hold only the last one (order: rate difference, physical stock, rejection). Use Get Purchase Returns or the screen to see all of them.

Known issue – Status: false with an empty message. If the document found is not a purchase voucher (for example a goods-in-transit voucher, a stock transfer in, or a purchase return with the same bill number), or nothing could be made although something looked pending, the answer is Status: false with an empty Message and nothing is saved. Check the voucher with the GRN prefix and number, and on the screen.

Known issue – technical text before the reason. Every failure message starts with technical text; the reason follows on the same first line. A failure while preparing a debit note shows only The operation was canceled. without a reason – open the voucher on the Generate Rate Diff/Phy Stock Debit Notes screen to see why.

Example request

Response

Field
Type
Meaning

Status

true / false

true when at least one debit note was made.

Message

text

Empty when debit notes were made; otherwise the reason (see the known issues).

LastSavedCode

number

Logic ERP's internal number of the last debit note made.

LastSavedDocNo

text

The last debit note's prefix and number joined by a hyphen, for example "RD-27". null when no debit note was made.

request_ID

text

Always empty for this endpoint.

Example response

Messages you may see

The reason follows technical text on the first line of Message.

Message
Meaning
What to do

Branch Code/Branch Short Name not Set.....

BranchCode is 0 or missing (a branch short name is not accepted).

Send BranchCode.

Invalid Bill_No....

Bill_No is empty.

Send the supplier's bill number.

Invalid GRN No....

GRN_Prefix was sent without GRN_Number.

Send both, or neither.

Unable to found Document againts Bill No. : …

No document with that bill number (and GRN) in the branch and current financial year.

Check the values and the branch.

Bill No. : … found mutiple times.Please Check

Several documents carry that bill number.

Add GRN_Prefix and GRN_Number.

Please Define Configuration for this module........

The rate-difference or physical-stock series or prefix is not set.

Ask your Logic ERP team to complete the configuration.

Unable to Generate Rate Difference/Physical Stock Debit Notes........

Nothing is pending for this voucher.

Nothing to do; or count the goods first.

The operation was canceled.

A debit note could not be prepared; the reason is not shown.

Check the voucher on the screen.

Last updated