# Bút toán

* Tính năng này dùng để lấy danh sách bút toán ở trên Nhanh.vn. Dữ liệu sẽ được phân trang, mỗi trang tối đa không quá 100 bút toán.

## Request

* Xem [Postman sample](https://www.postman.com/nhanh-vn/pos-open-nhanh-vn/request/nnymb4r/accounting-transaction).

```curl
curl --location --globoff 'https://pos.open.nhanh.vn/v3.0/accounting/transaction?appId={{appId}}&businessId={{businessId}}' \
--header 'Authorization: {{accessToken}}' \
--header 'Content-Type: application/json' \
--header 'Cookie: nvnKn0x6mr3=2ecdui6mukkck004kg65t3oqcq' \
--data '{
    "filters": {},
    "paginator": {
        "size": 50,
        "sort": {"id": "desc"},
        "next": ""
    }
}'
```

### Filters

| Key         | Type | Description                                                                                                                                    |
| ----------- | ---- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| id          | int  | ID bút toán                                                                                                                                    |
| fromDate    | date | Thời gian bắt đầu từ ngày định dạng (yyyy-mm-dd). VD: 2022-09-25                                                                               |
| toDate      | date | Thời gian đến ngày (yyyy-mm-dd). VD: 2022-09-25                                                                                                |
| typeDate    | int  | 1: Lọc theo ngày giao dịch (mặc định), 2: Lọc theo ngày tạo                                                                                    |
| type        | int  | [Loại bút toán](/v3/modelconstant.md#accounting-type)                                                                                          |
| mode        | int  | [Kiểu bút toán](/v3/modelconstant.md#accounting-mode)                                                                                          |
| filterMode  | int  | <p>Loại hoạch toán:<br>1: Tự động<br>2: Không tự động</p>                                                                                      |
| contactType | int  | <p>Koại đối tượng<br>1 = Khách hàng<br>2 = Nhà cung cấp<br>3 = Dịch vụ trả góp<br>4 = Nhân viên<br>20 = Khác<br>21:Sàn thương mại điện tử)</p> |

### Paginator

* Xem cấu trúc chung [tại đây](/v3/readme.md#paginator).

## Response

* Xem cấu trúc chung [tại đây](/v3/readme.md#response).

### Failed response

* Xem các mã lỗi chung [tại đây](/v3/readme.md#failed-response).

### Successful response

```json
{
    "code": 1,
    "paginator": {
      "next": "Dùng để lấy dữ liệu trang tiếp theo"
    },
    "data": [
        {
          "id": "(int) ID bút toán",
          "date": "(string) Ngày bút toán",
          "type": "(int) Loại bút toán",
          "mode": "(int) Kiểu bút toán",
          "amount": "(double) Số tiền bút toán",
          "itemType": "(int) Loại chứng từ",
          "itemId": "(int) ID chứng từ",
          "documentCode": "(string) ID chứng từ ngoài",
          "description": "(string) Mô tả bút toán",
          "items": [
              {
                  "amount": "(double) Số tiền bút toán",
                  "itemType": "(int) Loại chứng từ",
                  "itemId": "(int) ID chứng từ",
                  "description": "(string) Mô tả bút toán",
                  "credit": {
                      "id": "(int) ID tài khoản ghi có",
                      "name": "(string) Tên tài khoản",
                      "code": "(string) Mã tài khoản"
                  },
                  "debit": {
                      "id": "(int) ID tài khoản ghi nợ",
                      "name": "(string) Tên tài khoản",
                      "code": "(string) Mã tài khoản"
                  }
              }
          ],
          "depot": {
              "id": "(int) ID kho hàng",
              "name": "(string) Tên kho hàng"
          },
          "contact": {
              "id": "(int) ID đối tượng",
              "name": "(string) Tên đối tượng",
              "code": "(string) Mã đối tượng"
          },
          "created": {
              "id": "(int) ID người tạo bút toán",
              "name": "(string) Tên người tạo",
              "createdAt": "(int) Thời gian tạo, định dạng timestamp"
          }
        }
    ]
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://apidocs.nhanh.vn/v3/accounting/transaction.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
