Import Documents
NodeJS Example File
DocumentApiExample.js
Method | Description |
---|---|
createDoc | Imports and updates new or already existing temporary documents |
issueDocument | Check issue and input the document to the permanent storage |
delDocument | Delete document from tables |
getDoc | Show 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 API | invApi/createDoc |
NodeJS | createDocument |
Parameters | Description | Parameter Options/value | Default value |
---|---|---|---|
issueStock | issue the document | true / false | false |
deleteTemp | if errors found, delete document or not | true / false | false |
rows Required | document data object | See table below | |
moves Required | sub-transactions array for each rows array | See table below | |
matrix | sub-transactions array for each moves array | See table below |
JSON Body Example
{
...
"rows": {
...
"moves": [
{ ... },
{ ...
"matrix": [
{
...
}
]
}
]
}
}
FieldName-stock
The following parameters should be included in a rows
object (see example below)
FieldName-stock | Type | Description | תיאור | Default Value |
---|---|---|---|---|
StockID | Integer 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) | |
DocNumber | Integer 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
AccountName | String (max 50) | שם חשבון | Account name | null |
Address | String (max 100) | כתובת | Address | null |
City | String (max 50) | עיר | City | null |
Phone | String (max 30) | טלפון | Phone | null |
ValueDate | Date string – yyyy-mm-dd | תאריך | Date | null |
DiscountPrc | Float number | אחוז הנחה כללית במסמך | % of general discount | null |
Tftal | Float number | סכום כולל של מסמך | Total amount | null |
SumDiscount | Float number | סכום ההנחה במסמך | The discount amount | null |
Ref3 | Integer number | אסמכתא 3 | Reference-3 | 0 |
Remarks | String (max 250) | הערות | Remarks | null |
Details | String (max 250) | פרטים | details | null |
Warehouse | Integer number | מחסן | Warehouse | null |
Agent | Integer number | סוכן | Salesperson | null |
CostCode | String (max 8) | קוד תמחיר קיים | Existing cost center code | null |
Quantity | Float number | כמות | Quantity | 0 |
Osek874 | String (max 9) | עוסק מורשה | VAT registration number | null |
InterFlag | Integer number | קליטת נתונים בחנות וירטואלית | Import data for virtual store | 0 |
String (max 45) | כתובת דוא"ל | E-Mail address | null | |
TransAgent | number | העברה בין מחסנים: סוכן מקור | Transfer between warehouses: Source agent | 0 |
TransStore | number | העברה בין מחסנים: מחסן מקור | Transfer between warehouses: Source warehouse | 1 |
CurrencyCode | string(5) values | מטבע | currency | null |
MainRate | number | שער למטבע המסמך | currency rate | null |
EvalCurrencyCode | string(5) values | מטבע לשערוך | The revaluation currency | null |
Rate | number | שער לשערוך בהנהח"ש | Rate for revaluation | null |
ExtraText1 | String(max 50) | הערה נוספת 1 | Extra text 1 | null |
ExtraText2 | String(max 50) | הערה נוספת 2 | Extra text 2 | null |
ExtraText3 | String(max 50) | הערה נוספת 3 | Extra text 3 | null |
ExtraText4 | String(max 50) | הערה נוספת 4 | Extra text 4 | null |
ExtraText5 | String(max 50) | הערה נוספת 5 | Extra text 5 | null |
ExtraSum1 | Float number | סכום נוסף 1 | Extra sum 1 | null |
ExtraSum2 | Float number | סכום נוסף 2 | Extra sum 2 | null |
ExtraSum3 | Float number | סכום נוסף 3 | Extra sum 3 | null |
ExtraDate1 | Date string – yyyy-mm-dd | תאריך נוסף 1 | Extra date 1 | null |
ExtraDate2 | Date string – yyyy-mm-dd | תאריך נוסף 2 | Extra date 2 | null |
ExtraNum1 | Integer number | מספר נוסף 1 | Extra number 1 | null |
ExtraNum2 | Integer number | מספר נוסף 2 | Extra number 2 | null |
Copies | Integer number | מספר עותקים להדפסה | Number of print copies | From company definition |
PrintStyle | Integer number | מזהה פורמט הדפסה | Print format ID | From company definition |
taxnum | Integer 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-transactions | Type | Description | תיאור | Default Value |
---|---|---|---|---|
StockID | Integer number | מזהה טבלת stock | ID in the stock table | 0 |
MoveID | Integer number | מזהה טבלת stockmoves | ID in the stockmoves table | 0 |
ItemKey Required | String (max 20) | מפתח פריט | Item key | |
ItemName | String (max 100) | שם פריט | Item name | null |
Price | Float number | מחיר | Price | null |
Quantity Required | Float number | כמות | Quantity |
Additional fields
Tftal | Float number | סה"כ בשורה | Total amount of the line | null |
DiscountPrc | Float number | % הנחה | % discount | null |
Rate | Float number | שער | Currency rate | null |
CurrencyCode | String(max 5) values | מטבע | Currency | null |
CommitionPrc | Float number | % עמלה | % commission | null |
LineNoForSorting | Integer number | מספור שורה | Line ID | null |
Agent | Integer number | סוכן | Salesperson | null |
Warehouse | Integer number | מחסן | Warehouse | null |
Details | String(max 20) | פרטים | Details | null |
costcode | String (max 8) | קוד תמחיר קיים | Existing cost center code | null |
Counter | null | |||
Reference | Integer number | אסמ2 | Reference-2 | 0 |
packs | Float number | אריזות | Packs | null |
alternum | String (max 18) | מספר חליפי | Alter num | null |
DUEDATE | Date string – yyyy-mm-dd | תאריך ערך | Due date | null |
unit | String(max 5) | יחידת מידה | Unit | null |
ExtraText1 | String(max 50) | הערה נוספת 1 | Extra text 1 | null |
ExtraText2 | String(max 50) | הערה נוספת 2 | Extra text 2 | null |
ExtraSum1 | Float number | סכום נוסף 1 | Extra sum 1 | null |
ExtraSum2 | Float number | סכום נוסף 2 | Extra sum 2 | null |
ExtraDate1 | Date string – yyyy-mm-dd | תאריך נוסף 1 | Extra date 1 | null |
ExtraDate2 | Date string – yyyy-mm-dd | תאריך נוסף 2 | Extra date 2 | null |
BaseMoveId | number | מזהה שורת פריט במסמכי בסיס | id base stockmoves | 0 |
Sub-transactions for each Matrix item
The following parameters should be included in a matrix
array (see example below)
Sub-transactions | Type | Description | תיאור | Default Value |
---|---|---|---|---|
matrixsonkey | String (max 20) | מפתח פריט | Item key | "" |
matrixsonquantity | Float number | כמות | Quantity | 0 |
matrixfatherkey | Float 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 API | invApi/issueDocument |
NodeJS | issueDoc |
Parameters | Type | Description |
---|---|---|
stockID Required | Integer number | ID in the stock table |
JSON Example
{
"stockID": 626
}
Deleting Documents
Delete document from tables
REST API | invApi/delDocument |
NodeJS | delDocument |
Parameters | Type | Description |
---|---|---|
StockID Required | Integer number | ID in the stock table |
JSON Example
{
"stockID": 626
}
Showing Documents
Show document data
REST API | invApi/getDoc |
NodeJS | showDocument |
Parameters | Type | Description |
---|---|---|
StockID Required | Integer number | ID in the stock table |
JSON Example
{
"stockID": 626
}
Documents OutputData
Name | Options |
---|---|
NewDocumentStockID | New stockid |
DocumentIssuedStatus | IsError:"error description" / OK / IN TEMP |
TempDocumentDeleted | Yes / No |
ErrorsOnDoc | For temp documents only |
DocumentDetails | All 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"
}
]