متدهای ثبت سند حسابداری در رابطه برنامهنویسی حسابفا
پارامترها:
|
apiKey userId password loginToken |
پارامترهای اجباری برای تمامی متدها
(مشاهدۀ توضیحات) |
| number | شماره سند مورد نظر |
curl -X POST https://api.hesabfa.com/v1/document/get \
-H "Content-Type: application/json" \
-d '{
"apiKey": "your-api-key",
"loginToken": "your-login-token",
"number": 415
}'
<?php
$data = [
'apiKey' => 'your-api-key',
'loginToken' => 'your-login-token',
'number' => 415
];
$ch = curl_init("https://api.hesabfa.com/v1/document/get");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Content-Type: application/json"]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
const data = {
apiKey: "your-api-key",
loginToken: "your-login-token",
number: 415
};
fetch("https://api.hesabfa.com/v1/document/get", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(data)
})
.then(response => response.json())
.then(result => {
console.log(result);
});
import requests
data = {
"apiKey": "your-api-key",
"loginToken": "your-login-token",
"number": 415
}
response = requests.post(
"https://api.hesabfa.com/v1/document/get",
json=data
)
result = response.json()
print(result)
using System.Net.Http.Json;
using var client = new HttpClient();
var data = new
{
apiKey = "your-api-key",
loginToken = "your-login-token",
number = 415
};
var response = await client.PostAsJsonAsync("https://api.hesabfa.com/v1/document/get", data);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
آیتمهای موجود در پاسخ:
|
Success ErrorCode ErrorMessage |
(مشاهدۀ توضیحات) |
| Result | در صورت موفقیت آمیز بودن، Object سند مورد نظر درون Result قرار می گیرد. |
| Number | شماره سند |
| Reference | ارجاع |
| Date | تاریخ |
| Description | توضیحات |
| Project | پروژه |
| Debit | بدهکار |
| Credit | بستانکار |
| Status | وضعیت سند(جدول وضعیت سند) |
| Transactions | آرایهای از تراکنش های موجود در سند. هر تراکنش شامل ساختار زیر می باشد: |
| AccountPath | حساب |
| Description | توضیحات |
| Info | اطلاعات اضافه |
| Amount | مبلغ |
| CurrencyAmount | مبلغ در صورت چند ارزی بودن |
| Currency | واحد پول |
| Type | نوع تراکنش(جدول نوع تراکنش) |
| ContactCode | کد شخص |
| ProductCode | کد کالا |
| BankCode | کد بانک |
| CashCode | کد صندوق |
| PettyCashCode | کد تنخواهگردان |
{
"Success": true,
"ErrorCode": 0,
"ErrorMessage": "",
"Result": {
"Id": 2497,
"Number": 415,
"Reference": 441,
"Date": "2022-11-26T00:00:00",
"Description": "تست API",
"Project": "",
"Debit": 1000,
"Credit": 1000,
"Status": 1,
"Transactions": [
{
"Id": 14572,
"AccountPath": "بدهی ها : بدهیهای جاری : پیش دریافت ها : پیش دریافت فروش",
"Description": "تست API",
"Info": "",
"Amount": 1000,
"CurrencyAmount": 1000,
"Currency": "IRR",
"Type": 1,
"ContactCode": "000001",
"ProductCode": "",
"BankCode": "",
"CashCode": "",
"PettyCashCode": ""
},
{
"Id": 14573,
"AccountPath": "دارایی ها : دارایی های جاری : موجودی نقد و بانک : صندوق",
"Description": "تست API",
"Info": "",
"Amount": 1000,
"CurrencyAmount": 1000,
"Currency": "IRR",
"Type": 0,
"ContactCode": "",
"ProductCode": "",
"BankCode": "",
"CashCode": "0001",
"PettyCashCode": ""
}
]
}
}
پارامترها:
|
apiKey userId password loginToken |
پارامترهای اجباری برای تمامی متدها
(مشاهدۀ توضیحات) |
| document | Object نگهدارنده اطلاعات سند می باشد.هر Object شامل ساختار زیر می باشد: |
| number | شماره سند |
| reference | ارجاع |
| date | تاریخ |
| description | توضیحات |
| project | پروژه |
| debit | بدهکار |
| credit | بستانکار |
| status | وضعیت سند(جدول وضعیت سند) |
| transactions | آرایهای از تراکنش های موجود در سند. هر تراکنش شامل ساختار زیر می باشد: |
| accountPath | حساب |
| description | توضیحات |
| info | اطلاعات اضافه |
| amount | مبلغ |
| currencyAmount | مبلغ در صورت چند ارزی بودن |
| currency | واحد پول |
| type | نوع تراکنش (جدول نوع تراکنش) |
| contactCode | کد شخص |
| productCode | کد کالا |
| bankCode | کد بانک |
| cashCode | کد صندوق |
| pettyCashCode | کد تنخواهگردان |
{
"apiKey": "your-api-key",
"loginToken": "your-login-token",
"document": {
"number": 415,
"reference": 441,
"date": "2022-11-26T00:00:00",
"description": "پیش دریافت وجه از آقای محمدی",
"project": "",
"debit": 1000,
"credit": 1000,
"status": 1,
"transactions": [
{
"accountPath": "بدهی ها : بدهیهای جاری : پیش دریافت ها : پیش دریافت فروش",
"description": "پیش دریافت وجه از آقای محمدی",
"info": "",
"amount": 1000,
"currencyAmount": 1000,
"currency": "IRR",
"type": 1,
"contactCode": "000001",
"productCode": "",
"bankCode": "",
"cashCode": "",
"pettyCashCode": ""
},
{
"accountPath": "دارایی ها : دارایی های جاری : موجودی نقد و بانک : صندوق",
"description": "پیش دریافت وجه از آقای محمدی",
"info": "",
"amount": 1000,
"currencyAmount": 1000,
"currency": "IRR",
"type": 0,
"contactCode": "",
"productCode": "",
"bankCode": "",
"cashCode": "0001",
"pettyCashCode": ""
}
]
}
}
curl -X POST https://api.hesabfa.com/v1/document/save \
-H "Content-Type: application/json" \
-d '{
"apiKey": "your-api-key",
"loginToken": "your-login-token",
"document": {
"number": 415,
"reference": 441,
"date": "2022-11-26T00:00:00",
"description": "پیش دریافت وجه از آقای محمدی",
"project": "",
"debit": 1000,
"credit": 1000,
"status": 1,
"transactions": [
{
"accountPath": "بدهی ها : بدهیهای جاری : پیش دریافت ها : پیش دریافت فروش",
"description": "پیش دریافت وجه از آقای محمدی",
"info": "",
"amount": 1000,
"currencyAmount": 1000,
"currency": "IRR",
"type": 1,
"contactCode": "000001",
"productCode": "",
"bankCode": "",
"cashCode": "",
"pettyCashCode": ""
},
{
"accountPath": "دارایی ها : دارایی های جاری : موجودی نقد و بانک : صندوق",
"description": "پیش دریافت وجه از آقای محمدی",
"info": "",
"amount": 1000,
"currencyAmount": 1000,
"currency": "IRR",
"type": 0,
"contactCode": "",
"productCode": "",
"bankCode": "",
"cashCode": "0001",
"pettyCashCode": ""
}
]
}
}'
<?php
$data = [
'apiKey' => 'your-api-key',
'loginToken' => 'your-login-token',
'document' => [
'number' => 415,
'reference' => 441,
'date' => '2022-11-26T00:00:00',
'description' => 'پیش دریافت وجه از آقای محمدی',
'project' => '',
'debit' => 1000,
'credit' => 1000,
'status' => 1,
'transactions' => [
[
'accountPath' => 'بدهی ها : بدهیهای جاری : پیش دریافت ها : پیش دریافت فروش',
'description' => 'پیش دریافت وجه از آقای محمدی',
'info' => '',
'amount' => 1000,
'currencyAmount' => 1000,
'currency' => 'IRR',
'type' => 1,
'contactCode' => '000001',
'productCode' => '',
'bankCode' => '',
'cashCode' => '',
'pettyCashCode' => ''
],
[
'accountPath' => 'دارایی ها : دارایی های جاری : موجودی نقد و بانک : صندوق',
'description' => 'پیش دریافت وجه از آقای محمدی',
'info' => '',
'amount' => 1000,
'currencyAmount' => 1000,
'currency' => 'IRR',
'type' => 0,
'contactCode' => '',
'productCode' => '',
'bankCode' => '',
'cashCode' => '0001',
'pettyCashCode' => ''
]
]
]
];
$ch = curl_init("https://api.hesabfa.com/v1/document/save");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Content-Type: application/json"]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
const data = {
apiKey: "your-api-key",
loginToken: "your-login-token",
document: {
number: 415,
reference: 441,
date: "2022-11-26T00:00:00",
description: "پیش دریافت وجه از آقای محمدی",
project: "",
debit: 1000,
credit: 1000,
status: 1,
transactions: [
{
accountPath: "بدهی ها : بدهیهای جاری : پیش دریافت ها : پیش دریافت فروش",
description: "پیش دریافت وجه از آقای محمدی",
info: "",
amount: 1000,
currencyAmount: 1000,
currency: "IRR",
type: 1,
contactCode: "000001",
productCode: "",
bankCode: "",
cashCode: "",
pettyCashCode: ""
},
{
accountPath: "دارایی ها : دارایی های جاری : موجودی نقد و بانک : صندوق",
description: "پیش دریافت وجه از آقای محمدی",
info: "",
amount: 1000,
currencyAmount: 1000,
currency: "IRR",
type: 0,
contactCode: "",
productCode: "",
bankCode: "",
cashCode: "0001",
pettyCashCode: ""
}
]
}
};
fetch("https://api.hesabfa.com/v1/document/save", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(data)
})
.then(response => response.json())
.then(result => {
console.log(result);
});
import requests
data = {
"apiKey": "your-api-key",
"loginToken": "your-login-token",
"document": {
"number": 415,
"reference": 441,
"date": "2022-11-26T00:00:00",
"description": "پیش دریافت وجه از آقای محمدی",
"project": "",
"debit": 1000,
"credit": 1000,
"status": 1,
"transactions": [
{
"accountPath": "بدهی ها : بدهیهای جاری : پیش دریافت ها : پیش دریافت فروش",
"description": "پیش دریافت وجه از آقای محمدی",
"info": "",
"amount": 1000,
"currencyAmount": 1000,
"currency": "IRR",
"type": 1,
"contactCode": "000001",
"productCode": "",
"bankCode": "",
"cashCode": "",
"pettyCashCode": ""
},
{
"accountPath": "دارایی ها : دارایی های جاری : موجودی نقد و بانک : صندوق",
"description": "پیش دریافت وجه از آقای محمدی",
"info": "",
"amount": 1000,
"currencyAmount": 1000,
"currency": "IRR",
"type": 0,
"contactCode": "",
"productCode": "",
"bankCode": "",
"cashCode": "0001",
"pettyCashCode": ""
}
]
}
}
response = requests.post(
"https://api.hesabfa.com/v1/document/save",
json=data
)
result = response.json()
print(result)
using System.Net.Http.Json;
using var client = new HttpClient();
var data = new
{
apiKey = "your-api-key",
loginToken = "your-login-token",
document = new
{
number = 415,
reference = 441,
date = "2022-11-26T00:00:00",
description = "پیش دریافت وجه از آقای محمدی",
project = "",
debit = 1000,
credit = 1000,
status = 1,
transactions = new object[]
{
new
{
accountPath = "بدهی ها : بدهیهای جاری : پیش دریافت ها : پیش دریافت فروش",
description = "پیش دریافت وجه از آقای محمدی",
info = "",
amount = 1000,
currencyAmount = 1000,
currency = "IRR",
type = 1,
contactCode = "000001",
productCode = "",
bankCode = "",
cashCode = "",
pettyCashCode = ""
},
new
{
accountPath = "دارایی ها : دارایی های جاری : موجودی نقد و بانک : صندوق",
description = "پیش دریافت وجه از آقای محمدی",
info = "",
amount = 1000,
currencyAmount = 1000,
currency = "IRR",
type = 0,
contactCode = "",
productCode = "",
bankCode = "",
cashCode = "0001",
pettyCashCode = ""
}
}
}
};
var response = await client.PostAsJsonAsync("https://api.hesabfa.com/v1/document/save", data);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
نکات ضروری
- اگر شماره سند ذکر شود، سند انتخاب شده ویرایش خواهد شد. توجه کنید که تنها اسناد دستی قابل ذخیره و ویرایش هستند.
- در صورتی که تفصیل حساب انتخاب شده شخص باشد فیلد کد شخص، اگر کالا باشد فیلد کد کلا، اگر بانک باشد فیلد کد بانک، اگر صندوق باشد فیلد کد صندوق و اگر تنخواهگردان باشد فیلد کد تنخواهگردان برای هر تراکنش باید پر باشد.
- بدیهی است که سایر کدها برای آن تراکنش باید خالی باشند.
- برای ثبت تراکنش ارزی، در فیلد currencyAmount مبلغ ارزی تراکنش و در فیلد amount مبلغ تراکنش به ارز پایه سیستم باید ثبت شود.
- حداقل دو تراکنش باید در سند ثبت شود. اگر وضعیت سند را تایید شده انتخاب کنید، سند حتما باید تراز باشد.
آیتمهای موجود در پاسخ:
|
Success ErrorCode ErrorMessage |
(مشاهدۀ توضیحات) |
| Result | در صورت موفقیت آمیز بودن، Object سند ذخیره شده یا ویرایش شده درون Result قرار می گیرد. |
| Number | شماره سند |
| Reference | ارجاع |
| Date | تاریخ |
| Description | توضیحات |
| Project | پروژه |
| Debit | بدهکار |
| Credit | بستانکار |
| Status | وضعیت سند(جدول وضعیت سند) |
| Transactions | آرایهای از تراکنش های موجود در سند. هر تراکنش شامل ساختار زیر می باشد: |
| AccountPath | حساب |
| Description | توضیحات |
| Info | اطلاعات اضافه |
| Amount | مبلغ |
| CurrencyAmount | مبلغ در صورت چند ارزی بودن |
| Currency | واحد پول |
| Type | نوع تراکنش (جدول نوع تراکنش) |
| ContactCode | کد شخص |
| ProductCode | کد کالا |
| BankCode | کد بانک |
| CashCode | کد صندوق |
| PettyCashCode | کد تنخواهگردان |
{
"Success": true,
"ErrorCode": 0,
"ErrorMessage": "",
"Result": {
"Id": 2497,
"Number": 415,
"Reference": 441,
"Date": "2022-11-26T00:00:00",
"Description": "پیش دریافت وجه از آقای محمدی",
"Project": "",
"Debit": 1000,
"Credit": 1000,
"Status": 1,
"Transactions": [
{
"Id": 14572,
"AccountPath": "بدهی ها : بدهیهای جاری : پیش دریافت ها : پیش دریافت فروش",
"Description": "پیش دریافت وجه از آقای محمدی",
"Info": "",
"Amount": 1000,
"CurrencyAmount": 1000,
"Currency": "IRR",
"Type": 1,
"ContactCode": "000001",
"ProductCode": "",
"BankCode": "",
"CashCode": "",
"PettyCashCode": ""
},
{
"Id": 14573,
"AccountPath": "دارایی ها : دارایی های جاری : موجودی نقد و بانک : صندوق",
"Description": "پیش دریافت وجه از آقای محمدی",
"Info": "",
"Amount": 1000,
"CurrencyAmount": 1000,
"Currency": "IRR",
"Type": 0,
"ContactCode": "",
"ProductCode": "",
"BankCode": "",
"CashCode": "0001",
"PettyCashCode": ""
}
]
}
}
پارامترها:
|
apiKey userId password loginToken |
پارامترهای اجباری برای تمامی متدها
(مشاهدۀ توضیحات) |
| queryInfo | Object فیلتر و مرتبسازی (مشاهدۀ توضیحات) |
{
"apiKey": "your-api-key",
"loginToken": "your-login-token",
"queryInfo": {
"sortBy": "Date",
"sortDesc": true,
"take": 20,
"skip": 0
}
}
curl -X POST https://api.hesabfa.com/v1/document/getDocuments \
-H "Content-Type: application/json" \
-d '{
"apiKey": "your-api-key",
"loginToken": "your-login-token",
"queryInfo": {
"sortBy": "Date",
"sortDesc": true,
"take": 20,
"skip": 0
}
}'
<?php
$data = [
'apiKey' => 'your-api-key',
'loginToken' => 'your-login-token',
'queryInfo' => [
'sortBy' => 'Date',
'sortDesc' => true,
'take' => 20,
'skip' => 0
]
];
$ch = curl_init("https://api.hesabfa.com/v1/document/getDocuments");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Content-Type: application/json"]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
const data = {
apiKey: "your-api-key",
loginToken: "your-login-token",
queryInfo: {
sortBy: "Date",
sortDesc: true,
take: 20,
skip: 0
}
};
fetch("https://api.hesabfa.com/v1/document/getDocuments", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(data)
})
.then(response => response.json())
.then(result => {
console.log(result);
});
import requests
data = {
"apiKey": "your-api-key",
"loginToken": "your-login-token",
"queryInfo": {
"sortBy": "Date",
"sortDesc": True,
"take": 20,
"skip": 0
}
}
response = requests.post(
"https://api.hesabfa.com/v1/document/getDocuments",
json=data
)
result = response.json()
print(result)
using System.Net.Http.Json;
using var client = new HttpClient();
var data = new
{
apiKey = "your-api-key",
loginToken = "your-login-token",
queryInfo = new
{
sortBy = "Date",
sortDesc = true,
take = 20,
skip = 0
}
};
var response = await client.PostAsJsonAsync("https://api.hesabfa.com/v1/document/getDocuments", data);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
آیتمهای موجود در پاسخ:
|
Success ErrorCode ErrorMessage |
(مشاهدۀ توضیحات) |
| Result | درون فیلد result آرایهای از سندها قرار میگیرد. |
| TotalCount | تعداد کل |
| FilteredCount | تعداد فیلتر شده |
| From | شماره ردیف شروع |
| To | شماره ردیف خاتمه |
| List | لیستی از Objectهای نگهدارنده اطلاعات سند می باشد.هر Object سند شامل ساختار زیر می باشد: |
| Number | شماره سند |
| Reference | ارجاع |
| Date | تاریخ |
| Description | توضیحات |
| Project | پروژه |
| Debit | بدهکار |
| Credit | بستانکار |
| Status | وضعیت سند(جدول وضعیت سند) |
| Transactions | تراکنش ها |
{
"Success": true,
"ErrorCode": 0,
"ErrorMessage": "",
"Result": {
"TotalCount": 22,
"FilteredCount": 22,
"From": 1,
"To": 10,
"List": [
{
"Id": 2497,
"Number": 415,
"Reference": 441,
"Date": "2022-11-26T00:00:00",
"Description": "پیش دریافت وجه از آقای محمدی",
"Project": "",
"Debit": 1000,
"Credit": 1000,
"Status": 1,
"Transactions": []
}
]
}
}
پارامترها:
|
apiKey userId password loginToken |
پارامترهای اجباری برای تمامی متدها
(مشاهدۀ توضیحات) |
| number | شماره سند |
curl -X POST https://api.hesabfa.com/v1/document/delete \
-H "Content-Type: application/json" \
-d '{
"apiKey": "your-api-key",
"loginToken": "your-login-token",
"number": 415
}'
<?php
$data = [
'apiKey' => 'your-api-key',
'loginToken' => 'your-login-token',
'number' => 415
];
$ch = curl_init("https://api.hesabfa.com/v1/document/delete");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Content-Type: application/json"]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
const data = {
apiKey: "your-api-key",
loginToken: "your-login-token",
number: 415
};
fetch("https://api.hesabfa.com/v1/document/delete", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(data)
})
.then(response => response.json())
.then(result => {
console.log(result);
});
import requests
data = {
"apiKey": "your-api-key",
"loginToken": "your-login-token",
"number": 415
}
response = requests.post(
"https://api.hesabfa.com/v1/document/delete",
json=data
)
result = response.json()
print(result)
using System.Net.Http.Json;
using var client = new HttpClient();
var data = new
{
apiKey = "your-api-key",
loginToken = "your-login-token",
number = 415
};
var response = await client.PostAsJsonAsync("https://api.hesabfa.com/v1/document/delete", data);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
نکات ضروری
توجه کنید که فقط اسناد دستی قابل حذف هستند.
آیتمهای موجود در پاسخ:
|
Success ErrorCode ErrorMessage |
(مشاهدۀ توضیحات) |
| Result | در صورت موفقیت آمیز بودن مقدار true درون Result قرار می گیرد. |