Skip to main content

Import Documents

NodeJS Example File

DocumentApiExample.js

MethodDescription
createDocImports and updates new or already existing temporary documents
issueDocumentCheck issue and input the document to the permanent storage
delDocumentDelete document from tables
getDocShow document data

Creating Documents

Imports and updates new or already existing temporary documents. You may check for errors or issue and input the documents into the permanent storage (if no errors were found).

REST APIinvApi/createDoc
NodeJScreateDocument

ParametersDescriptionParameter Options/valueDefault value
issueStockissue the documenttrue / falsefalse
deleteTempif errors found, delete document or nottrue / falsefalse
rows
Required
document data objectSee table below
moves
Required
sub-transactions array for each rows arraySee table below
matrix sub-transactions array for each moves arraySee table below

JSON Body Example

{
...

"rows": {
...
"moves": [
{ ... },
{ ...
"matrix": [
{
...
}
]
}
]
}
}

FieldName-stock

The following parameters should be included in a rows object (see example below)

FieldName-stockTypeDescriptionתיאורDefault
Value
StockIDInteger numberמזהה טבלת stock.
כאשר מעדכנים מסמך, חייבים להעביר מזהה
ID in the stock table.
Required when updating an existing document.
0
DocumentID
Required
Integer numberסוג מסמך
(לפי הגדרות בטבלת DocumentsDef)
Document type
(according to the DocumentDef table)
DocNumberInteger numberמספר המסמך.
הספרור של מסמכים בעלי ספרור קשיח נקבע בעת ההפקה
Document number.
When the document numeration is unchangeable, the number is determined when the document is issued.
1
AccountKey
Required
String (max 15)מפתח חשבון (לקוח/ספק)The customer or supplier account key
Additional fields
AccountNameString (max 50)שם חשבוןAccount namenull
AddressString (max 100)כתובתAddressnull
CityString (max 50)עירCitynull
PhoneString (max 30)טלפוןPhonenull
ValueDateDate string –
yyyy-mm-dd
תאריךDatenull
DiscountPrcFloat numberאחוז הנחה כללית במסמך% of general discountnull
TftalFloat numberסכום כולל של מסמךTotal amountnull
SumDiscountFloat numberסכום ההנחה במסמךThe discount amountnull
Ref3Integer numberאסמכתא 3Reference-30
RemarksString (max 250)הערותRemarksnull
DetailsString (max 250)פרטיםdetailsnull
WarehouseInteger numberמחסןWarehousenull
AgentInteger numberסוכןSalespersonnull
CostCodeString (max 8)קוד תמחיר קייםExisting cost center codenull
QuantityFloat numberכמותQuantity0
Osek874String (max 9)עוסק מורשהVAT registration numbernull
InterFlagInteger numberקליטת נתונים בחנות וירטואליתImport data for virtual store0
EmailString (max 45)כתובת דוא"ל
שידור כתובת מייל אומר שליחת מקור למייל לא משנה מה מוגדר בחשבון (הפקה לא דיגיטלית או שליחה במייל לאחר תצוגה)
E-Mail address
Sending an email address means the source will be sent to it regardless of what is defined the account (non-digital production or sending by email after display)
null
TransAgentnumberהעברה בין מחסנים: סוכן מקורTransfer between warehouses: Source agent0
TransStorenumberהעברה בין מחסנים: מחסן מקורTransfer between warehouses: Source warehouse1
CurrencyCodestring(5)
values
מטבעcurrencynull
MainRatenumberשער למטבע המסמךcurrency ratenull
EvalCurrencyCodestring(5)
values
מטבע לשערוךThe revaluation currencynull
Ratenumberשער לשערוך בהנהח"שRate for revaluationnull
ExtraText1String(max 50)הערה נוספת 1Extra text 1null
ExtraText2String(max 50)הערה נוספת 2Extra text 2null
ExtraText3String(max 50)הערה נוספת 3Extra text 3null
ExtraText4String(max 50)הערה נוספת 4Extra text 4null
ExtraText5String(max 50)הערה נוספת 5Extra text 5null
ExtraSum1Float numberסכום נוסף 1Extra sum 1null
ExtraSum2Float numberסכום נוסף 2Extra sum 2null
ExtraSum3Float numberסכום נוסף 3Extra sum 3null
ExtraDate1Date string –
yyyy-mm-dd
תאריך נוסף 1Extra date 1null
ExtraDate2Date string –
yyyy-mm-dd
תאריך נוסף 2Extra date 2null
ExtraNum1Integer numberמספר נוסף 1Extra number 1null
ExtraNum2Integer numberמספר נוסף 2Extra number 2null
CopiesInteger numberמספר עותקים להדפסהNumber of print copies From company definition
PrintStyleInteger numberמזהה פורמט הדפסהPrint format ID From company definition
taxnumInteger numberמספר הקצאה (חשבונית רכש, חשבונית שריון ספק וחשבונית סוכן)Allocation number (Purchase invoice, supplier reserve invoice and agent invoice) null

Sub-transactions for each StockID

The following parameters should be included in a moves array (see example below)

Sub-transactionsTypeDescriptionתיאורDefault
Value
StockIDInteger numberמזהה טבלת stockID in the stock table0
MoveIDInteger numberמזהה טבלת stockmovesID in the stockmoves table0
ItemKey
Required
String (max 20)מפתח פריטItem key
ItemNameString (max 100)שם פריטItem namenull
PriceFloat numberמחירPricenull
Quantity
Required
Float numberכמותQuantity
Additional fields
TftalFloat numberסה"כ בשורהTotal amount of the linenull
DiscountPrcFloat number% הנחה% discountnull
RateFloat numberשערCurrency ratenull
CurrencyCodeString(max 5)
values
מטבעCurrencynull
CommitionPrcFloat number% עמלה% commissionnull
LineNoForSortingInteger numberמספור שורהLine IDnull
AgentInteger numberסוכןSalespersonnull
WarehouseInteger numberמחסןWarehousenull
DetailsString(max 20)פרטיםDetailsnull
costcodeString (max 8)קוד תמחיר קייםExisting cost center codenull
Counternull
ReferenceInteger numberאסמ2Reference-20
packsFloat numberאריזותPacksnull
alternumString (max 18)מספר חליפיAlter numnull
DUEDATEDate string –
yyyy-mm-dd
תאריך ערךDue datenull
unitString(max 5)יחידת מידהUnitnull
ExtraText1String(max 50)הערה נוספת 1Extra text 1null
ExtraText2String(max 50)הערה נוספת 2Extra text 2null
ExtraSum1Float numberסכום נוסף 1Extra sum 1null
ExtraSum2Float numberסכום נוסף 2Extra sum 2null
ExtraDate1Date string –
yyyy-mm-dd
תאריך נוסף 1Extra date 1null
ExtraDate2Date string –
yyyy-mm-dd
תאריך נוסף 2Extra date 2null
BaseMoveIdnumberמזהה שורת פריט במסמכי בסיסid base stockmoves0

Sub-transactions for each Matrix item

The following parameters should be included in a matrix array (see example below)

Sub-transactionsTypeDescriptionתיאורDefault
Value
matrixsonkeyString (max 20)מפתח פריטItem key""
matrixsonquantityFloat numberכמותQuantity0
matrixfatherkeyFloat numberמפתח פריט האבFather-item key""

JSON Example

{
"issueStock": "true",
"deleteTemp": "false",
"rows": {
"StockID": 0,
"DocumentID": 1,
"DocNumber": 1,
"AccountKey": "30005",
"AccountName": "כיתנס",
"Address": "מנחם בגין 169",
"City": "תל אביב",
"Phone": "0525554434",
"ValueDate": "2021-11-11",
"DiscountPrc": 15,
"Remarks": "הערות בתחתית המסמך",
"Warehouse": 2,
"Agent": 20,
"Osek874": 123456789,
"moves": [
{
"ItemKey": "1004",
"ItemName": "עציץ גוזמניה",
"Price": 35,
"Quantity": 4,
"DiscountPrc": 10,
"Rate": 3.5,
"CurrencyCode": "$",
"DUEDATE": "2021-01-25"
},
{
"ItemKey": "1003",
"ItemName": "סוקולנט",
"Price": 20,
"Quantity": 4,
"Tftal": 70
},
{
"matrix": [
{
"matrixsonkey": "1453",
"matrixsonquantity": 5,
"matrixfatherkey": "1004"
}
]
}
]
}
}

Issuing Documents

Check issue and input the document to the permanent storage

REST APIinvApi/issueDocument
NodeJSissueDoc

ParametersTypeDescription
stockID
Required
Integer numberID in the stock table

JSON Example

{
"stockID": 626
}

Deleting Documents

Delete document from tables

REST APIinvApi/delDocument
NodeJSdelDocument

ParametersTypeDescription
StockID
Required
Integer numberID in the stock table

JSON Example

{
"stockID": 626
}

Showing Documents

Show document data

REST APIinvApi/getDoc
NodeJSshowDocument

ParametersTypeDescription
StockID
Required
Integer numberID in the stock table

JSON Example

{
"stockID": 626
}

Documents OutputData

NameOptions
NewDocumentStockIDNew stockid
DocumentIssuedStatusIsError:"error description" / OK / IN TEMP
TempDocumentDeletedYes / No
ErrorsOnDocFor temp documents only
DocumentDetailsAll document data

JSON Examples

 [
{
"NewDocumentStockID": 22771,
"DocumentIssuedStatus": "OK",
"DocumentDetails": [
[
{
"StockID": 22771,
"DocumentID": 78,
"DocNumber": 18067,
"status": 1,
"AccountKey": "20000",
"accountname": "ספק כללי",
"Address": null,
"City": null,
"Phone": null,
"batch": 9999,
"ValueDate": "2024-06-20",
"duedate": "2024-06-20",
"paydate": "2024-06-20",
"copies": 2,
"DiscountPrc": 0.025900025900005286,
"Tftal": 17.37,
"vatprc": 17,
"tftalvatfree": 0,
"tftalvat": 14.85,
"reference": null,
"remarks": null,
"printstyle": 1,
"Details": null,
"Agent": 0,
"currency": "ש\"ח",
"rate": null,
"mainrate": 1,
"issuedate": "2024-06-20"
}
],
[
{
"StockID": 22771,
"moveid": 34762,
"itemkey": "1",
"itemname": "כללי",
"Warehouse": 1,
"Agent": 0,
"Details": null,
"duedate": "2024-06-20",
"status": 1,
"CurrencyCode": "ש\"ח",
"rate": 1,
"Price": 14.85,
"Quantity": 1,
"Tftal": 14.85,
"DiscountPrc": 0
}
]
],
"tax": "ok"
}
]