Save a Purchase Voucher
Creates a purchase voucher (purchase bill / GRN) in Logic ERP from a supplier's bill. The goods are received into your branch's stock in the lots you send, the supplier's account is credited, and Logic ERP gives the voucher its own GRN number. Use this endpoint when your system records goods bought on a supplier's invoice. Goods that arrive on a delivery challan, to be billed later, are recorded as a purchase challan instead.
Endpoint
Address
https://your-server/api/SavePurchaseVoucher
Method
POST
Authorization
Basic Auth
The response envelope, branches, dates and the common messages are explained in How Every API Call Works.
Send one voucher per request. Field names are matched without regard to upper/lower case. Fields not listed below are ignored. Do not send null for LogicUser_Code or AddlItemCode: send "" or leave the field out. Otherwise the request fails with a technical error. With the standard routine, "LstItems": null is refused with Item Details Not Defined....
Two save routines
Logic ERP has two routines that can save this endpoint. A setting of your API site decides which one runs. Your Logic ERP support team can tell you which one your site uses.
The standard routine is used unless your site is switched to the newer one. Everything on this page up to the section If your API site uses the newer save routine describes it.
The newer routine fills in Logic ERP's purchase voucher screen for you, so the screen's own checks and defaults for your series apply. The fields are the same, but several behave differently. See the section at the end.
You can tell them apart by the answer: only the newer routine returns the fields Order_No and ErrorCode.
Request fields
BranchCode
number
No
0
The branch receiving the goods, by Logic ERP's branch number (Branch_Code in Get Branch Info).
BranchShortName
text
No
empty
The branch by its short name. Used only when BranchCode is 0.
AccountCode
text
Yes
–
The supplier's party code (User_Code in Get Party Master). The supplier must already exist in Logic ERP. This is the account the voucher is posted to. Its tax region, payment terms, transporter and default discounts are used.
SupplierCode
text
No
AccountCode
A different party code to record as the supplier of the goods, for example when one account is billed for several suppliers. Must exist. Leave it out when the supplier is the same party.
Bill_No
text
No*
empty
The supplier's bill number. It is stored on the voucher and on every lot created. *Required when your API site checks for duplicate supplier bills (see the rules).
Bill_Date
date
No
InvoiceDate
The supplier's bill date, yyyy-MM-dd. It is also the purchase date of the lots.
PartyBillDate
date
No
InvoiceDate
The party bill date, yyyy-MM-dd.
InvoiceDate
date
No
today
The voucher date in Logic ERP, yyyy-MM-dd. The voucher is saved in the financial year this date falls in (see the rules).
GRN_Prefix
text
No
the series' GRN prefix, else GRN
Prefix of the GRN number Logic ERP gives the voucher, for example "GRN". The number itself is always the next free number for that prefix.
GR_Number, GR_Date
text, date
No
empty
The transporter's GR / LR number and date.
GRDate
date
No
empty
Also the GR / LR date. It overrides GR_Date when both are sent.
Godown_Name
text
No
your API site's default godown
Godown to receive the stock into, by name as in Logic ERP. Must exist. With no godown at all, the stock is received without a godown.
OrderNo, OrderDate
text, date
No
empty
Your purchase order reference and its date. Stored only; not checked.
ChallanNo, ChallanDate
text, date
No
empty
The supplier's delivery challan number and date. Stored only.
PU_Remarks_1
text
No
empty
Remarks.
PU_Remarks_2, PU_Remarks_3
text
No
empty
Remarks.
AgentName
text
No
empty
Agent or broker, by name as in Logic ERP. Must exist.
TransporterName
text
No
the supplier's transporter
Transporter, by name as in Logic ERP. Must exist.
TransportMode, VehicleNo
text
No
empty
Mode of transport and vehicle number.
Cases, Weight, PVTMark
text
No
empty
Number of cases, weight and private mark.
DeliveryAt, DeliveryAdd1, DeliveryAdd2
text
No
empty
Delivery place and address lines.
Insurance_Policy_No, Declaration_No
text
No
empty
Insurance policy number and declaration number.
GPN_No, GPN_Date
text, date
No
empty
Gate pass number and date. When GPN_No is sent, GPN_Date must be a valid date.
CostCenter
text
No
empty
Cost centre, by name as in Logic ERP. Must exist.
CurrencyName, ExchangeRate
text, number
No
empty, 0
Foreign currency, by name as in Logic ERP, and its rate. The currency must exist. The rate is used when it is more than 0.
CreditDays
number
No
the supplier's payment terms
Credit days. Used when more than 0.
Freight, Adjustment_Rs, SpDiscountRs, SchemeRs, AdjustUnit
number
No
0
Freight, adjustment, special discount, scheme amount in ₹ and adjustment per unit for the whole bill. Each is used only when more than 0.
CD_P, TD_P, SP_CD
number
No
the supplier's defaults
Bill-level CD %, TD % and special CD %. Each is used when more than 0.
Series_Code
number
No
–
Logic ERP's internal number of a purchase-voucher series. Used only when your API site has no default series for this endpoint. Otherwise it is replaced by that default. It is not checked to be a purchase-voucher series, so prefer the default series.
LstItems
list
Yes
–
The items received. See the table below. The list can also be sent as ListItems.
DisplayError
text
No
"0"
"1" = put the full technical error text in Message when something fails.
Doc_Type
text
No
"PU"
Leave it out. With any value other than "PU" or "PR" the reverse-charge marking of the tax region is not applied.
DNO_Code, Challan_Code, PO_Code, EntrySource, Request_ID, Sup_Code
–
No
–
Ignored by this endpoint.
LstItems — one entry per line. Lines are kept as sent: the same item may appear on several lines.
LogicUser_Code
text
Yes, or AddlItemCode
empty
The item code shown in Logic ERP (UserCode in Get Item Master). Upper/lower case does not matter. The item must already exist. Items are never created by this endpoint.
AddlItemCode
text
Yes, or LogicUser_Code
empty
The item's additional code / barcode (AddlItemCode in Get Item Master). It is used when LogicUser_Code is empty or not found. When LogicUser_Code is empty, any other barcode stored for the item is also accepted.
ScannedQty
number
Yes
–
Quantity received. It must be more than 0.
LotNo
text
Yes
–
The lot (batch) number to receive the goods into. See Lots and rates below.
BasicRate
number
No
0
The purchase rate per unit the line is billed at. The line amount is BasicRate × ScannedQty. With 0 the line has no value.
PurRate
number
No
0
Purchase rate per unit, stored on the lot.
SaleRate
number
No
0
Sale rate per unit, stored on the lot.
Lot_Mrp
number
No
0
MRP per unit, stored on the lot.
SP_Rate_1 … SP_Rate_5
number
No
0
The five special rates per unit, stored on the lot.
Expiry_Date, MFG_Date
date
No
empty
Expiry and manufacturing date of the lot. A value that is not a date is ignored.
ItemDescription
text
No
empty
A description stored on the line.
Production_Unit
text
No
empty
Production unit of the lot.
Godown_Code
number
No
Godown_Name
Logic ERP's internal godown number for this line only. It must exist.
LotCode, Lot_Bill_No, Org_Production_Unit
–
No
–
Ignored for a purchase voucher.
Rules Logic ERP applies
Series, branch and date
The voucher is saved in the default purchase-voucher series set for this endpoint in your API site. There is no field to choose a series, except
Series_Codewhen no default is set. With neither, nothing is saved.The branch is
BranchCode, elseBranchShortName.The voucher is saved in the financial year
InvoiceDatefalls in, also an earlier year. A date that no financial year in Logic ERP covers is refused withNo financial year covers the date dd/MM/yyyy.WithoutInvoiceDatethe voucher is dated today and saved in the current year.A voucher dated after today is refused unless Logic ERP allows post-dated purchases for your API user. A date in a period locked in Logic ERP is refused.
Supplier and taxes
The supplier (
AccountCode) is found by its party code as sent.SupplierCode, when sent, must exist too. Both must be a customer, supplier or cash account in Logic ERP. Any other account, such as a bank or expense account, is refused.The tax region comes only from the supplier: the purchase tax region set for that supplier at this branch, else the tax region on the supplier's account. When
SupplierCodeis sent and a branch-wise tax region is set for that supplier, it is used instead. No request field sets the tax region. A supplier with no tax region cannot be used, even if the series has a default tax region. Set the tax region on the party in Logic ERP first.If the tax region is marked as reverse charge in Logic ERP, the voucher is marked as reverse charge.
Taxes are worked out by Logic ERP from the tax region and each item's tax set-up. When the series takes taxes item-wise, every item must have purchase tax details for that tax region. When the series takes taxes for the whole bill, the series must have a default tax type.
The supplier's payment terms, transporter and default CD % / TD % / special CD % in Logic ERP are filled in.
CreditDays,TransporterName,CD_P,TD_PandSP_CDreplace them at bill level when sent. The supplier's default percentages are still applied to each line.
Items, lots and rates
Each item is found by
LogicUser_Code, elseAddlItemCode. An unknown code stops the request. Items are never created.LotNois required on every line. If a lot with that number already exists for the item (in the same godown, depending on the series), the stock is added to that lot, its purchase date, supplier and supplier bill number are replaced with this voucher's, and its rates and MRP can be overwritten with the ones sent. Otherwise a new lot is created with the rates, MRP, expiry and manufacturing dates, production unit, supplier and supplier bill number of this voucher.Your API site can be set to add the production unit to the lot number. A line with
"LotNo": "B2611"and"Production_Unit": "U1"then goes into lotB2611|U1.Rates are not checked:
0is accepted for every rate. Rate formulas set in the series may recalculate the sale rate, purchase rate or MRP when the voucher is saved. Check the lots in Logic ERP before relying on the rates being stored exactly as sent.Stock goes to the line's
Godown_Code, elseGodown_Name, else your API site's default godown, else no godown.
Duplicate supplier bills
When
Bill_Nois filled, a purchase voucher of the same supplier at the same branch in the current financial year with the same bill number is always refused. The supplier isSupplierCode, elseAccountCode.Your API site can also be set to check more widely. Then
Bill_Nomust be filled, and a purchase voucher with the sameBill_Noin this financial year is refused:for this supplier at this branch, or
for this supplier at any branch, or
for any supplier at any branch – only this setting also looks in the previous financial year.
Saving
The voucher, its lots and the stock are saved in one step. If anything fails, no voucher is saved.
If this endpoint is switched off for your API site, the answer is
Status: truewithLastSavedCode0andRequest cannot be processed. API Template is marked as In-Active in the configuration.inMessage. Nothing was saved. Always checkLastSavedCodeas well asStatus.
Known issue – wider duplicate check with
SupplierCode. WhenSupplierCodediffers fromAccountCode, your API site's "this supplier at this branch" and "this supplier at any branch" duplicate checks look for earlier bills of theAccountCodeparty: a bill entered earlier with theAccountCodeparty as supplier is refused, and with "this supplier at any branch" a bill already entered for the supplier at another branch is not caught. Check for duplicates in your own system in that case.
Apostrophes in codes and names. Party codes, item codes, godown, agent, transporter, cost centre and currency names may contain an apostrophe (
'), for exampleD'SOUZA. Leave apostrophes out ofBill_NoandGRN_Prefix: Logic ERP's own purchase routine also uses them.
Example request
Response
Status
true / false
true = the voucher was saved. Also true, with LastSavedCode 0, when the endpoint is switched off (see the rules).
Message
text
Why it failed. Empty on success.
LastSavedCode
number
Logic ERP's internal number of the voucher. Use it to find the voucher in the purchase vouchers you pull with Get Purchase Vouchers.
request_ID
text
The ID of this request. Quote it to support.
LastSavedDocNo
text
The GRN number given to the voucher, as prefix and number, for example GRN-1452.
Example response
Messages you may see
All with Status: false. Text in … is replaced by the value concerned. Messages marked † come from the save itself: they are preceded and followed by technical text, so look for the reason on the first line. With "DisplayError": "1" the other messages carry technical text too, except these, which are always plain: No financial year covers the date …, Default Configuration Not Defined in API Template, Account Code Not Defined..., Invalid Account User Code..., Invalid Supplier Code Defined..., the three invalid-date messages, Invoice Date Date not within financial year.Please Check...., Post Dated enteries are not allowed......., Entry/Modification is locked for this period...., Item Details Not Defined..., Logic User Code/Additional Item Code Not Defined for Item No : …, Quantity Not Defined For : '…' Item No : … and Lot Number Not Defined For : '…' Item No : ….
Default Configuration Not Defined in API Template
No default series is set for this endpoint and no Series_Code was sent.
Ask your Logic ERP team to set the default purchase series.
Account Code Not Defined...
AccountCode is empty.
Send the supplier's party code.
Invalid Account User Code...
No party has that AccountCode.
Check the code with Get Party Master.
Invalid Supplier Code Defined...
No party has that SupplierCode.
Send an existing party code, or leave the field out.
Invalid Invoice Date Defined..., Invalid Bill Date..., Invalid Party Bill Date...
A date that is not a date.
Send dates as yyyy-MM-dd.
No financial year covers the date …
No financial year in Logic ERP covers InvoiceDate.
Send a date inside a financial year of Logic ERP.
Invoice Date Date not within financial year.Please Check....
InvoiceDate falls outside the financial year the voucher is being saved in.
Send a valid date; if it persists, contact support with the request_ID.
Account Code : … is not a Customer / Supplier / Cash account..Please Check...
AccountCode or SupplierCode is not a customer, supplier or cash account.
Send the party code of a supplier.
Item Details Not Defined...
LstItems was sent as null.
Send the item list.
Post Dated enteries are not allowed.......
InvoiceDate is after today.
Send today's date or earlier.
Entry/Modification is locked for this period....
The date falls in a period locked in Logic ERP.
Use a date outside the locked period, or ask the Logic ERP user to unlock it.
Bill No can't be blank...
Your API site checks duplicate supplier bills and Bill_No is empty.
Send the supplier's bill number.
Bill No:… already exists for current supplier and current Branch, Bill No:… already exists for current supplier.., Bill No:… already exists.
This supplier bill number has already been entered (see the rules).
Do not send the same bill twice. If it really is a new bill, ask the Logic ERP user.
Bill No:… already exists for this supplier... Cannot Continue. †
A voucher of the same supplier at this branch in this financial year already has this bill number.
Do not send the same bill twice.
Logic User Code/Additional Item Code Not Defined for Item No : …
A line has neither code. The number is the line's position.
Fill one of the codes.
Invalid LogicUserCode / EANCode : …
The item code / barcode is not in Logic ERP. The code is shown in capitals.
Check the code with Get Item Master.
Quantity Not Defined For : '…' Item No : …
A quantity of 0 or less. The item code sent and the line number are shown.
Send a positive quantity.
Lot Number Not Defined For : '…' Item No : …
A line without LotNo. The item code sent and the line number are shown.
Send a lot number on every line.
Invalid Godown Name […]. Please Check...
Godown_Name not found.
Use a godown name from Logic ERP.
Error Finding Godown...… †
A line's Godown_Code does not exist.
Send an existing godown number, or leave it out.
Invalid Agent […] .Please Check
AgentName not found.
Use the name exactly as in Logic ERP.
Unable to found Cost Center […] .Please Check †, Transporter Name [ … ] not found. Please Check... †, Currency Name [ … ] not found. Please Check... †
A name sent does not exist in Logic ERP.
Use the name exactly as in Logic ERP.
Invalid GPN_Date .Please Check †
GPN_No sent without a valid GPN_Date.
Send both.
Default Tax Region not Set.Please Check....
The supplier has no tax region (see the rules).
Set the tax region on the party in Logic ERP.
Please set Default Tax Type before import this document....... †
The series works out taxes for the whole bill but has no default tax type.
Ask your Logic ERP team to complete the series.
Purchase / Tax Details not found for all Items. Check Row No.: … †
An item has no purchase tax details for the supplier's tax region.
Complete the item's tax set-up in Logic ERP.
Unable to Find Items for Import... †
LstItems is empty.
Send at least one line.
Error while saving voucher † or another reason †
Logic ERP could not save the voucher.
Read the first line; if unclear, contact support with the request_ID.
Request cannot be processed. API Template is marked as In-Active in the configuration. (with Status: true)
The endpoint is switched off for your API site. Nothing was saved.
Ask your Logic ERP support team.
If your API site uses the newer save routine
The newer routine takes the same request and fills in Logic ERP's purchase voucher screen with it. The differences are:
Messages are plain text. With
"DisplayError": "1"they carry the full technical text.The answer also has
Order_No, the same value asLastSavedDocNo, andErrorCode, which carries Logic ERP's error number for some refusals (for example220001withInvalid Party / Supplier Account...) and is empty otherwise.The party is
SupplierCodewhen sent, otherwiseAccountCode. It must be a customer, supplier or cash account. WhenSupplierCodeis sent,AccountCodeis not used, except that a differentAccountCodethat names an existing party must also be a customer, supplier or cash account.Dates. The financial year is taken from
Bill_Date(today when it is left out). ABill_Datethat no financial year covers is refused withNo financial year covers the date dd/MM/yyyy.The voucher date isInvoiceDate, else Logic ERP's current date. If that is earlier thanBill_DateorPartyBillDate, it is raised to the later of the two. A date that is not a valid date is refused. The post-dated and locked-period checks are made onBill_Datewhen it is sent, otherwise on the voucher date.Series. Only the default series of your API site is used.
Series_Codeis ignored. If that series is not available to the API user at the branch, the request is refused.GR_Numberis put in the voucher's own GRN number, not stored as the transporter's GR number.GR_Dateis ignored. UseGRDatefor the GR date.Lots and rates follow the screen's rules for your series.
LotNois required unless the series numbers lots automatically. The series may require a purchase rate, a sale rate or an MRP. The MRP may have to be at least every rate. Every rate is entered on the screen as sent: a rate left out or sent as0is entered as0and replaces any rate the screen filled in. Any message the screen would show the user becomes a failure. For example, a lot number that already exists with a different rate can be refused withOriginal Basic Rate:… will be replaced by ….Not applied: your API site's duplicate-supplier-bill setting, default godown, goods-in-transit setting and adding the production unit to the lot number.
Duplicate supplier bills follow the series: a series set to refuse them refuses them. A series set only to warn has its warning answered Yes, so the voucher is saved. Do not rely on this routine to refuse a supplier bill number that was already entered.
Doc_Typehas no effect in the newer routine. Leave it out.Switched off. When this endpoint is switched off for your API site, the answer is also
Status: truewithLastSavedCode0, and the same message. Nothing was saved.Different messages:
Default Purchase Voucher Configuration Not Selected!!,Default Purchase Voucher Configuration (…) is not available for this user / branch. Please Check...,Purchase Voucher Party / Supplier not Set...,Invalid Party / Supplier Account...,Account Code : … is not a Customer / Supplier / Cash account..Please Check...,Invalid Branch Code : …. Please Check...,Invalid InvoiceDate : …. Please Check...,Invalid Bill_Date : …. Please Check...,Invalid PartyBillDate : …. Please Check...,LogicUserCode Or EAN Code Cannot Blank!!,Quantity cannot be blank. Logic User Code : …,Purchase Voucher not saved. Please Check..., and the screen's own messages such asInvalid Lot Number,Enter Rate,Enter Purchase Rate,Enter Sale Rate,M.R.P. Entry is mandatory......,Sale Rate cannot be greater than MRP... Please check.andInvalid Quantity.
Known issue – the newer routine does not save. On some installations every request through the newer routine fails with Object reference not set to an instance of an object. after the lot number has been checked, and nothing is saved. If you see this message, ask your Logic ERP support team to switch this endpoint to the standard routine.
Last updated