# Finance

## Get Incomes

<mark style="color:blue;">`GET`</mark> `https://open-api.zortout.com/v4/Finance/GetIncomes`

Get list of incomes.

#### Query Parameters

| Name                 | Type   | Description                                                |
| -------------------- | ------ | ---------------------------------------------------------- |
| incomedateafter      | String | <p>Income Date After .....<br>(yyyy-MM-dd)</p>             |
| incomedatebefore     | String | <p>Income Date Before .....<br>(yyyy-MM-dd)</p>            |
| createdafter         | String | <p>Created Date After .....<br>(yyyy-MM-dd)</p>            |
| createdbefore        | String | <p>Created Date Before .....<br>(yyyy-MM-dd)</p>           |
| updatedafter         | String | <p>Updated Date After .....<br>(yyyy-MM-dd)</p>            |
| updatedbefore        | String | <p>Updated Date Before .....<br>(yyyy-MM-dd)</p>           |
| paymentafter         | String | <p>Paid Date After .....<br>(yyyy-MM-dd)</p>               |
| page                 | Int    | Page (Default = 1)                                         |
| keyword              | String | Keyword to search                                          |
| updatedatetimebefore | String | <p>Updated Datetime Before .....<br>(yyyy-MM-dd HH:mm)</p> |
| updatedatetimeafter  | String | <p>Updated Datetime After .....<br>(yyyy-MM-dd HH:mm)</p>  |
| createdatetimebefore | String | <p>Created Datetime Before .....<br>(yyyy-MM-dd HH:mm)</p> |
| createdatetimeafter  | String | <p>Created Datetime After .....<br>(yyyy-MM-dd HH:mm)</p>  |
| paymentbefore        | String | <p>Paid Date Before .....<br>(yyyy-MM-dd)</p>              |
| limit                | Int    | Limit per page (Max = 500)                                 |

#### Headers

| Name                                        | Type   | Description                                    |
| ------------------------------------------- | ------ | ---------------------------------------------- |
| storename<mark style="color:red;">\*</mark> | String | Store Name                                     |
| apikey<mark style="color:red;">\*</mark>    | String | API Key                                        |
| apisecret<mark style="color:red;">\*</mark> | String | API Secret                                     |
| incomeidlist                                | String | <p>List Of Income ID <br>Ex. “123,124,125”</p> |

{% tabs %}
{% tab title="Response" %}

| Parameter | Type                      | Description/Example                   |
| --------- | ------------------------- | ------------------------------------- |
| res       | Response                  | <p>Response Code <br>200- Success</p> |
| list      | IncomeTransaction (Array) | IncomeTransaction List (Array)        |
| count     | Int                       | Total income number by filter         |

| IncomeTransaction (Array) | Type               | Description/Example                                                             |
| ------------------------- | ------------------ | ------------------------------------------------------------------------------- |
| id                        | Int                | Income ID                                                                       |
| contactid                 | Int                | Contact ID                                                                      |
| contactname               | String             | Contact Name                                                                    |
| contactidnumber           | String             | Contact ID Number/Tax ID                                                        |
| contactemail              | String             | Contact Email                                                                   |
| contactphone              | String             | Contact Phone                                                                   |
| contactaddress            | String             | Contact Address                                                                 |
| contactbranchname         | String             | Contact Branch Name                                                             |
| contactbranchno           | String             | Contact Branch No                                                               |
| paymentstatus             | String             | Payment Status (Pending, Paid, Partial Payment, Excess Payment)                 |
| amount                    | Double             | Net Amount                                                                      |
| amount\_pretax            | Double             | Pretax Amount                                                                   |
| vatamount                 | Double             | Vat Amount                                                                      |
| incomedate                | Date               | <p>Income Date<br>(yyyy-MM-dd)</p>                                              |
| incomedateString          | String             | Income Date Text (yyyy-MM-dd)                                                   |
| paymentamount             | Double             | Payment Amount                                                                  |
| reference                 | String             | Reference                                                                       |
| description               | String             | Description                                                                     |
| discount                  | String             | <p>Discount<br>Ex.5.00, 10%</p>                                                 |
| vattype                   | Int                | <p>Vat Type <br>1 – No Vat (Default) <br>2 – Exclude Vat<br>3 – Include Vat</p> |
| list                      | IncomeItem (Array) | Item List                                                                       |
| payments                  | Payment (Array)    | Payment List                                                                    |
| tag                       | String (Array)     | Tag List (Array)                                                                |
| createdatetime            | Datetime           | Created Datetime                                                                |
| createdatetimeString      | String             | <p>Created Datetime Text <br>(yyyy-MM-dd HH:mm)</p>                             |
| updatedatetime            | Datetime           | Updated Datetime                                                                |
| updatedatetimeString      | String             | <p>Updated Datetime Text<br>(yyyy-MM-dd HH:mm)</p>                              |
| createuserid              | Int                | Created User ID                                                                 |
| createusername            | String             | Created User (Username)                                                         |
| createdby                 | String             | Created User (Display name)                                                     |
| uniquenumber              | String             | Unique Number                                                                   |

| IncomeItem (Array) | Type   | Description/Example |
| ------------------ | ------ | ------------------- |
| id                 | Int    | Item ID             |
| name               | String | Item Name           |
| categoryname       | String | Item Category       |
| totalprice         | Double | Total Price         |
| totalprice\_pretax | Double | Pretax Total Price  |
| totalprice\_vat    | Double | Total Vat           |

| Payment (Array)       | Type     | Description/Example                                 |
| --------------------- | -------- | --------------------------------------------------- |
| id                    | Int      | Payment ID                                          |
| name                  | String   | Payment Method Name                                 |
| amount                | Double   | Payment Amount                                      |
| paymentdatetime       | Datetime | Payment Datetime                                    |
| paymentdatetimeString | String   | <p>Payment Datetime Text <br>(yyyy-MM-dd HH:mm)</p> |
| {% endtab %}          |          |                                                     |
| {% endtabs %}         |          |                                                     |

## Get Income Detail

<mark style="color:blue;">`GET`</mark> `https://open-api.zortout.com/v4/Finance/GetIncomeDetail`

Get income detail.

#### Query Parameters

| Name                                 | Type | Description |
| ------------------------------------ | ---- | ----------- |
| id<mark style="color:red;">\*</mark> | Int  | Income ID   |

#### Headers

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| storename<mark style="color:red;">\*</mark> | String | Store Name  |
| apikey<mark style="color:red;">\*</mark>    | String | API Key     |
| apisecret<mark style="color:red;">\*</mark> | String | API Secret  |

{% tabs %}
{% tab title="Response" %}

| Parameter            | Type               | Description/Example                                                             |
| -------------------- | ------------------ | ------------------------------------------------------------------------------- |
| id                   | Int                | Income ID                                                                       |
| contactid            | Int                | Contact ID                                                                      |
| contactname          | String             | Contact Name                                                                    |
| contactidnumber      | String             | Contact ID Number/Tax ID                                                        |
| contactemail         | String             | Contact Email                                                                   |
| contactphone         | String             | Contact Phone                                                                   |
| contactaddress       | String             | Contact Address                                                                 |
| contactbranchname    | String             | Contact Branch Name                                                             |
| contactbranchno      | String             | Contact Branch No                                                               |
| paymentstatus        | String             | Payment Status (Pending, Paid, Partial Payment, Excess Payment)                 |
| amount               | Double             | Net Amount                                                                      |
| amount\_pretax       | Double             | Pretax Amount                                                                   |
| vatamount            | Double             | Vat Amount                                                                      |
| incomedate           | Date               | <p>Income Date Text <br>(yyyy-MM-dd)</p>                                        |
| incomedateString     | String             | Income Date Text (yyyy-MM-dd)                                                   |
| paymentamount        | Double             | Payment Amount                                                                  |
| reference            | String             | Reference                                                                       |
| description          | String             | Description                                                                     |
| discount             | String             | <p>Discount<br>Ex.5.00, 10%</p>                                                 |
| vattype              | Int                | <p>Vat Type <br>1 – No Vat (Default) <br>2 – Exclude Vat<br>3 – Include Vat</p> |
| list                 | IncomeItem (Array) | Item List                                                                       |
| payments             | Payment (Array)    | Payment List                                                                    |
| tag                  | String (Array)     | Tag List (Array)                                                                |
| createdatetime       | Datetime           | Created Datetime                                                                |
| createdatetimeString | String             | <p>Created Datetime Text <br>(yyyy-MM-dd HH:mm)</p>                             |
| updatedatetime       | Datetime           | Updated Datetime                                                                |
| updatedatetimeString | String             | <p>Updated Datetime Text<br>(yyyy-MM-dd HH:mm)</p>                              |
| createuserid         | Int                | Created User ID                                                                 |
| createusername       | String             | Created User (Username)                                                         |
| createdby            | String             | Created User (Display name)                                                     |
| uniquenumber         | String             | Unique Number                                                                   |

| IncomeItem (Array) | Type   | Description/Example |
| ------------------ | ------ | ------------------- |
| id                 | Int    | Item ID             |
| name               | String | Item Name           |
| categoryname       | String | Item Category       |
| totalprice         | Double | Total Price         |
| totalprice\_pretax | Double | Pretax Total Price  |
| totalprice\_vat    | Double | Total Vat           |

| Payment (Array)       | Type     | Description/Example                                 |
| --------------------- | -------- | --------------------------------------------------- |
| id                    | Int      | Payment ID                                          |
| name                  | String   | Payment Method Name                                 |
| amount                | Double   | Payment Amount                                      |
| paymentdatetime       | Datetime | Payment Datetime                                    |
| paymentdatetimeString | String   | <p>Payment Datetime Text <br>(yyyy-MM-dd HH:mm)</p> |
| {% endtab %}          |          |                                                     |
| {% endtabs %}         |          |                                                     |

## Add Income

<mark style="color:green;">`POST`</mark> `https://open-api.zortout.com/v4/Finance/AddIncome`

Add income.

#### Query Parameters

| Name         | Type   | Description                                                                                 |
| ------------ | ------ | ------------------------------------------------------------------------------------------- |
| uniquenumber | String | <p>Unique Number.</p><p>This value is unique and used to prevent duplicate transaction.</p> |

#### Headers

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| storename<mark style="color:red;">\*</mark> | String | Store Name  |
| apikey<mark style="color:red;">\*</mark>    | String | API Key     |
| apisecret<mark style="color:red;">\*</mark> | String | API Secret  |

#### Request Body

| Name                                           | Type               | Description                                                                                                                                                                                                                                                                      |
| ---------------------------------------------- | ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| contactname                                    | String             | Contact Name                                                                                                                                                                                                                                                                     |
| contactidnumber                                | String             | Contact ID Number/Tax ID                                                                                                                                                                                                                                                         |
| contactemail                                   | String             | Contact Email                                                                                                                                                                                                                                                                    |
| contactphone                                   | String             | Contact Phone                                                                                                                                                                                                                                                                    |
| contactaddress                                 | String             | Contact Address                                                                                                                                                                                                                                                                  |
| contactbranchname                              | String             | Contact Branch Name                                                                                                                                                                                                                                                              |
| amount<mark style="color:red;">\*</mark>       | Double             | Net Amount                                                                                                                                                                                                                                                                       |
| customerbranchno                               | String             | Contact Branch No                                                                                                                                                                                                                                                                |
| vatamount                                      | Double             | Vat Amount                                                                                                                                                                                                                                                                       |
| vattype                                        | Int                | <p>Vat Type <br>1 – No Vat<br>2 – Exclude Vat<br>3 – Include Vat<br>If vattype is not defined, the system will use vatamount to calculate and define automatically.<br>If vattype = 1, 2 or 3, the system will ignore vatamount and calculate vatamount value automatically.</p> |
| incomedate                                     | String             | <p>Income Date<br>Ex. "2021-09-15"</p>                                                                                                                                                                                                                                           |
| paymentmethod                                  | String             | Payment Method                                                                                                                                                                                                                                                                   |
| paymentamount                                  | Double             | <p>Payment Amount</p><p>("paymentmethod" must be required.)</p>                                                                                                                                                                                                                  |
| paymentdate                                    | String             | <p>Payment Datetime <br>Ex. “2021-09-15 21:05”</p>                                                                                                                                                                                                                               |
| description                                    | String             | Description                                                                                                                                                                                                                                                                      |
| discount                                       | String             | <p>Discount <br>Ex. 5.00, 10%</p>                                                                                                                                                                                                                                                |
| tag                                            | String (Array)     | Tag List (Array)                                                                                                                                                                                                                                                                 |
| list                                           | IncomeItem (Array) | Item List                                                                                                                                                                                                                                                                        |
| ∟ name<mark style="color:red;">\*</mark>       | String             | Item Name                                                                                                                                                                                                                                                                        |
| ∟ categoryname                                 | String             | Item Category                                                                                                                                                                                                                                                                    |
| ∟ totalprice<mark style="color:red;">\*</mark> | Double             | Total Price                                                                                                                                                                                                                                                                      |
| reference                                      | String             | Reference                                                                                                                                                                                                                                                                        |

{% tabs %}
{% tab title="Response" %}

| Parameter | Type   | Description/Example                   |
| --------- | ------ | ------------------------------------- |
| resCode   | String | <p>Response Code <br>200- Success</p> |
| resDesc   | String | Response Description                  |
| detail    | Detail | Detail                                |

| Detail       | Type | Description/Example |
| ------------ | ---- | ------------------- |
| id           | Int  | Income ID           |
| {% endtab %} |      |                     |

{% tab title="Ex. Request JSON" %}

```json
{
  "incomedate": "2021-05-31",
  "amount": 58,
  "vatamount": 0,
  "paymentmethod": "Cash",
  "list": [
    {
      "name": "Income1",
      "categoryname": "Others",
      "totalprice": 48
    },
    {
      "name": "Income2",
      "totalprice": 10
    }
  ]
}
```

{% endtab %}
{% endtabs %}

## Update Income Payment

<mark style="color:green;">`POST`</mark> `https://open-api.zortout.com/v4/Finance/UpdateIncomePayment`

Update payment of income.

#### Query Parameters

| Name                                            | Type   | Description                                        |
| ----------------------------------------------- | ------ | -------------------------------------------------- |
| id<mark style="color:red;">\*</mark>            | Int    | Income ID                                          |
| paymentdate                                     | String | <p>Payment Datetime <br>Ex. “2021-09-15 21:05”</p> |
| paymentamount<mark style="color:red;">\*</mark> | Double | Payment Amount                                     |
| paymentmethod<mark style="color:red;">\*</mark> | String | Payment Method                                     |

#### Headers

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| storename<mark style="color:red;">\*</mark> | String | Store Name  |
| apikey<mark style="color:red;">\*</mark>    | String | API Key     |
| apisecret<mark style="color:red;">\*</mark> | String | API Secret  |

{% tabs %}
{% tab title="Response" %}

| Parameter     | Type   | Description/Example                   |
| ------------- | ------ | ------------------------------------- |
| resCode       | String | <p>Response Code <br>200- Success</p> |
| resDesc       | String | Response Description                  |
| {% endtab %}  |        |                                       |
| {% endtabs %} |        |                                       |

## Get Expenses

<mark style="color:blue;">`GET`</mark> `https://open-api.zortout.com/v4/Finance/GetExpenses`

Get list of expenses.

#### Query Parameters

| Name                 | Type   | Description                                                |
| -------------------- | ------ | ---------------------------------------------------------- |
| expensedateafter     | String | <p>Expense Date After .....<br>(yyyy-MM-dd)</p>            |
| limit                | Int    | Limit per page (Max = 500)                                 |
| page                 | Int    | Page (Default = 1)                                         |
| keyword              | String | Keyword to search                                          |
| updatedatetimebefore | String | <p>Updated Datetime Before .....<br>(yyyy-MM-dd HH:mm)</p> |
| updatedatetimeafter  | String | <p>Updated Datetime After .....<br>(yyyy-MM-dd HH:mm)</p>  |
| createdatetimebefore | String | <p>Created Datetime Before .....<br>(yyyy-MM-dd HH:mm)</p> |
| createdatetimeafter  | String | <p>Created Datetime After .....<br>(yyyy-MM-dd HH:mm)</p>  |
| paymentbefore        | String | <p>Paid Date Before .....<br>(yyyy-MM-dd)</p>              |
| paymentafter         | String | <p>Paid Date After .....<br>(yyyy-MM-dd)</p>               |
| updatedbefore        | String | <p>Updated Date Before .....<br>(yyyy-MM-dd)</p>           |
| updatedafter         | String | <p>Updated Date After .....<br>(yyyy-MM-dd)</p>            |
| createdbefore        | String | <p>Created Date Before .....<br>(yyyy-MM-dd)</p>           |
| createdafter         | String | <p>Created Date After .....<br>(yyyy-MM-dd)</p>            |
| expensedatebefore    | String | <p>Expense Date Before .....<br>(yyyy-MM-dd)</p>           |

#### Headers

| Name                                        | Type   | Description                                     |
| ------------------------------------------- | ------ | ----------------------------------------------- |
| storename<mark style="color:red;">\*</mark> | String | Store Name                                      |
| apikey<mark style="color:red;">\*</mark>    | String | API Key                                         |
| apisecret<mark style="color:red;">\*</mark> | String | API Secret                                      |
| expenseidlist                               | String | <p>List Of Expense ID <br>Ex. “123,124,125”</p> |

{% tabs %}
{% tab title="Response" %}

| Parameter | Type                       | Description/Example                   |
| --------- | -------------------------- | ------------------------------------- |
| res       | Response                   | <p>Response Code <br>200- Success</p> |
| list      | ExpenseTransaction (Array) | ExpenseTransaction List (Array)       |
| count     | Int                        | Total expense number by filter        |

| ExpenseTransaction (Array) | Type                | Description/Example                                                             |
| -------------------------- | ------------------- | ------------------------------------------------------------------------------- |
| id                         | Int                 | Expense ID                                                                      |
| contactid                  | Int                 | Contact ID                                                                      |
| contactname                | String              | Contact Name                                                                    |
| contactidnumber            | String              | Contact ID Number/Tax ID                                                        |
| contactemail               | String              | Contact Email                                                                   |
| contactphone               | String              | Contact Phone                                                                   |
| contactaddress             | String              | Contact Address                                                                 |
| contactbranchname          | String              | Contact Branch Name                                                             |
| contactbranchno            | String              | Contact Branch No                                                               |
| paymentstatus              | String              | Payment Status (Pending, Paid, Partial Payment, Excess Payment)                 |
| amount                     | Double              | Net Amount                                                                      |
| amount\_pretax             | Double              | Pretax Amount                                                                   |
| vatamount                  | Double              | Vat Amount                                                                      |
| expensedate                | Date                | <p>Expense Date Text <br>(yyyy-MM-dd)</p>                                       |
| expensedateString          | String              | Expense Date Text (yyyy-MM-dd)                                                  |
| paymentamount              | Double              | Payment Amount                                                                  |
| reference                  | String              | Reference                                                                       |
| description                | String              | Description                                                                     |
| discount                   | String              | <p>Discount<br>Ex.5.00, 10%</p>                                                 |
| vattype                    | Int                 | <p>Vat Type <br>1 – No Vat (Default) <br>2 – Exclude Vat<br>3 – Include Vat</p> |
| list                       | ExpenseItem (Array) | Item List                                                                       |
| payments                   | Payment (Array)     | Payment List                                                                    |
| tag                        | String (Array)      | Tag List (Array)                                                                |
| createdatetime             | Datetime            | Created Datetime                                                                |
| createdatetimeString       | String              | <p>Created Datetime Text <br>(yyyy-MM-dd HH:mm)</p>                             |
| updatedatetime             | Datetime            | Updated Datetime                                                                |
| updatedatetimeString       | String              | <p>Updated Datetime Text<br>(yyyy-MM-dd HH:mm)</p>                              |
| createuserid               | Int                 | Created User ID                                                                 |
| createusername             | String              | Created User (Username)                                                         |
| createdby                  | String              | Created User (Display name)                                                     |
| uniquenumber               | String              | Unique Number                                                                   |

| ExpenseItem (Array) | Type   | Description/Example |
| ------------------- | ------ | ------------------- |
| id                  | Int    | Item ID             |
| name                | String | Item Name           |
| categoryname        | String | Item Category       |
| totalprice          | Double | Total Price         |
| totalprice\_pretax  | Double | Pretax Total Price  |
| totalprice\_vat     | Double | Total Vat           |

| Payment (Array)       | Type     | Description/Example                                 |
| --------------------- | -------- | --------------------------------------------------- |
| id                    | Int      | Payment ID                                          |
| name                  | String   | Payment Method Name                                 |
| amount                | Double   | Payment Amount                                      |
| paymentdatetime       | Datetime | Payment Datetime                                    |
| paymentdatetimeString | String   | <p>Payment Datetime Text <br>(yyyy-MM-dd HH:mm)</p> |
| {% endtab %}          |          |                                                     |
| {% endtabs %}         |          |                                                     |

## Get Expense Detail

<mark style="color:blue;">`GET`</mark> `https://open-api.zortout.com/v4/Finance/GetExpenseDetail`

Get expense detail.

#### Query Parameters

| Name                                 | Type | Description |
| ------------------------------------ | ---- | ----------- |
| id<mark style="color:red;">\*</mark> | Int  | Expense ID  |

#### Headers

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| storename<mark style="color:red;">\*</mark> | String | Store Name  |
| apikey<mark style="color:red;">\*</mark>    | String | API Key     |
| apisecret<mark style="color:red;">\*</mark> | String | API Secret  |

{% tabs %}
{% tab title="Response" %}

| Parameter            | Type                | Description/Example                                                             |
| -------------------- | ------------------- | ------------------------------------------------------------------------------- |
| id                   | Int                 | Expense ID                                                                      |
| contactid            | Int                 | Contact ID                                                                      |
| contactname          | String              | Contact Name                                                                    |
| contactidnumber      | String              | Contact ID Number/Tax ID                                                        |
| contactemail         | String              | Contact Email                                                                   |
| contactphone         | String              | Contact Phone                                                                   |
| contactaddress       | String              | Contact Address                                                                 |
| contactbranchname    | String              | Contact Branch Name                                                             |
| contactbranchno      | String              | Contact Branch No                                                               |
| paymentstatus        | String              | Payment Status (Pending, Paid, Partial Payment, Excess Payment)                 |
| amount               | Double              | Net Amount                                                                      |
| amount\_pretax       | Double              | Pretax Amount                                                                   |
| vatamount            | Double              | Vat Amount                                                                      |
| expensedate          | Date                | Expense Date                                                                    |
| expensedateString    | String              | Expense Date Text (yyyy-MM-dd)                                                  |
| paymentamount        | Double              | Payment Amount                                                                  |
| reference            | String              | Reference                                                                       |
| description          | String              | Description                                                                     |
| discount             | String              | <p>Discount <br>Ex.5.00, 10%</p>                                                |
| vattype              | Int                 | <p>Vat Type <br>1 – No Vat (Default) <br>2 – Exclude Vat<br>3 – Include Vat</p> |
| list                 | ExpenseItem (Array) | Item List                                                                       |
| payments             | Payment (Array)     | Payment List                                                                    |
| tag                  | String (Array)      | Tag List (Array)                                                                |
| createdatetime       | Datetime            | Created Datetime                                                                |
| createdatetimeString | String              | <p>Created Datetime Text <br>(yyyy-MM-dd HH:mm)</p>                             |
| updatedatetime       | Datetime            | Updated Datetime                                                                |
| updatedatetimeString | String              | <p>Updated Datetime Text<br>(yyyy-MM-dd HH:mm)</p>                              |
| createuserid         | Int                 | Created User ID                                                                 |
| createusername       | String              | Created User (Username)                                                         |
| createdby            | String              | Created User (Display name)                                                     |
| uniquenumber         | String              | Unique Number                                                                   |

| ExpenseItem (Array) | Type   | Description/Example |
| ------------------- | ------ | ------------------- |
| id                  | Int    | Item ID             |
| name                | String | Item Name           |
| categoryname        | String | Item Category       |
| totalprice          | Double | Total Price         |
| totalprice\_pretax  | Double | Pretax Total Price  |
| totalprice\_vat     | Double | Total Vat           |

| Payment (Array)       | Type     | Description/Example                                 |
| --------------------- | -------- | --------------------------------------------------- |
| id                    | Int      | Payment ID                                          |
| name                  | String   | Payment Method Name                                 |
| amount                | Double   | Payment Amount                                      |
| paymentdatetime       | Datetime | Payment Datetime                                    |
| paymentdatetimeString | String   | <p>Payment Datetime Text <br>(yyyy-MM-dd HH:mm)</p> |
| {% endtab %}          |          |                                                     |
| {% endtabs %}         |          |                                                     |

## Add Expense

<mark style="color:green;">`POST`</mark> `https://open-api.zortout.com/v4/Finance/AddExpense`

Add expense.

#### Query Parameters

| Name         | Type   | Description                                                                                 |
| ------------ | ------ | ------------------------------------------------------------------------------------------- |
| uniquenumber | String | <p>Unique Number.</p><p>This value is unique and used to prevent duplicate transaction.</p> |

#### Headers

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| storename<mark style="color:red;">\*</mark> | String | Store Name  |
| apikey<mark style="color:red;">\*</mark>    | String | API Key     |
| apisecret<mark style="color:red;">\*</mark> | String | API Secret  |

#### Request Body

| Name                                           | Type                | Description                                                                                                                                                                                                                                                                      |
| ---------------------------------------------- | ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| contactname                                    | String              | Contact Name                                                                                                                                                                                                                                                                     |
| contactidnumber                                | String              | Contact ID Number/Tax ID                                                                                                                                                                                                                                                         |
| contactemail                                   | String              | Contact Email                                                                                                                                                                                                                                                                    |
| contactphone                                   | String              | Contact Phone                                                                                                                                                                                                                                                                    |
| contactaddress                                 | String              | Contact Address                                                                                                                                                                                                                                                                  |
| paymentamount                                  | Double              | <p>Payment Amount</p><p>("paymentmethod" must be required.)</p>                                                                                                                                                                                                                  |
| paymentmethod                                  | String              | Payment Method                                                                                                                                                                                                                                                                   |
| expensedate                                    | String              | <p>Expense Date<br>Ex. "2021-09-15"</p>                                                                                                                                                                                                                                          |
| vattype                                        | Int                 | <p>Vat Type <br>1 – No Vat<br>2 – Exclude Vat<br>3 – Include Vat<br>If vattype is not defined, the system will use vatamount to calculate and define automatically.<br>If vattype = 1, 2 or 3, the system will ignore vatamount and calculate vatamount value automatically.</p> |
| vatamount                                      | Double              | Vat Amount                                                                                                                                                                                                                                                                       |
| amount<mark style="color:red;">\*</mark>       | Double              | Net Amount                                                                                                                                                                                                                                                                       |
| contactbranchno                                | String              | Contact Branch No                                                                                                                                                                                                                                                                |
| contactbranchname                              | String              | Contact Branch Name                                                                                                                                                                                                                                                              |
| ∟ name<mark style="color:red;">\*</mark>       | String              | Item Name                                                                                                                                                                                                                                                                        |
| list                                           | ExpenseItem (Array) | Item List                                                                                                                                                                                                                                                                        |
| tag                                            | String (Array)      | Tag List (Array)                                                                                                                                                                                                                                                                 |
| discount                                       | String              | <p>Discount <br>Ex. 5.00, 10%</p>                                                                                                                                                                                                                                                |
| description                                    | String              | Description                                                                                                                                                                                                                                                                      |
| paymentdate                                    | String              | <p>Payment Datetime <br>Ex. “2021-09-15 21:05”</p>                                                                                                                                                                                                                               |
| ∟ categoryname                                 | String              | Item Category                                                                                                                                                                                                                                                                    |
| ∟ totalprice<mark style="color:red;">\*</mark> | Double              | Total Price                                                                                                                                                                                                                                                                      |
| reference                                      | String              | Reference                                                                                                                                                                                                                                                                        |

{% tabs %}
{% tab title="Response" %}

| Parameter | Type   | Description/Example                   |
| --------- | ------ | ------------------------------------- |
| resCode   | String | <p>Response Code <br>200- Success</p> |
| resDesc   | String | Response Description                  |
| detail    | Detail | Detail                                |

| Detail       | Type | Description/Example |
| ------------ | ---- | ------------------- |
| id           | Int  | Expense ID          |
| {% endtab %} |      |                     |

{% tab title="Ex. Request JSON" %}

```json
{
  "expensedate": "2021-05-31",
  "amount": 58,
  "vatamount": 0,
  "paymentmethod": "Cash",
  "list": [
    {
      "name": "Income1",
      "categoryname": "Others",
      "totalprice": 48
    },
    {
      "name": "Income2",
      "totalprice": 10
    }
  ]
}
```

{% endtab %}
{% endtabs %}

## Update Expense Payment

<mark style="color:green;">`POST`</mark> `https://open-api.zortout.com/v4/Finance/UpdateExpensePayment`

Update payment of expense.

#### Query Parameters

| Name                                            | Type   | Description                                        |
| ----------------------------------------------- | ------ | -------------------------------------------------- |
| id<mark style="color:red;">\*</mark>            | Int    | Expense ID                                         |
| paymentdate                                     | String | <p>Payment Datetime <br>Ex. “2021-09-15 21:05”</p> |
| paymentamount<mark style="color:red;">\*</mark> | Double | Payment Amount                                     |
| paymentmethod<mark style="color:red;">\*</mark> | String | Payment Method                                     |

#### Headers

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| storename<mark style="color:red;">\*</mark> | String | Store Name  |
| apikey<mark style="color:red;">\*</mark>    | String | API Key     |
| apisecret<mark style="color:red;">\*</mark> | String | API Secret  |

{% tabs %}
{% tab title="Response" %}

| Parameter     | Type   | Description/Example                   |
| ------------- | ------ | ------------------------------------- |
| resCode       | String | <p>Response Code <br>200- Success</p> |
| resDesc       | String | Response Description                  |
| {% endtab %}  |        |                                       |
| {% endtabs %} |        |                                       |

## Get Money Transfers

<mark style="color:blue;">`GET`</mark> `https://open-api.zortout.com/v4/Finance/GetMoneyTransfers`

Get list of money transfer.

#### Query Parameters

| Name                 | Type   | Description                                                |
| -------------------- | ------ | ---------------------------------------------------------- |
| dateafter            | String | <p>Date After .....<br>(yyyy-MM-dd)</p>                    |
| page                 | Int    | Page (Default = 1)                                         |
| keyword              | String | Keyword to search                                          |
| createdatetimebefore | String | <p>Created Datetime Before .....<br>(yyyy-MM-dd HH:mm)</p> |
| createdatetimeafter  | String | <p>Created Datetime After .....<br>(yyyy-MM-dd HH:mm)</p>  |
| datebefore           | String | <p>Date Before .....<br>(yyyy-MM-dd)</p>                   |
| limit                | Int    | Limit per page (Max = 500)                                 |

#### Headers

| Name                                        | Type   | Description                                            |
| ------------------------------------------- | ------ | ------------------------------------------------------ |
| storename<mark style="color:red;">\*</mark> | String | Store Name                                             |
| apikey<mark style="color:red;">\*</mark>    | String | API Key                                                |
| apisecret<mark style="color:red;">\*</mark> | String | API Secret                                             |
| moneytransferidlist                         | String | <p>List Of Money Transfer ID <br>Ex. “123,124,125”</p> |

{% tabs %}
{% tab title="Response" %}

| Parameter | Type                   | Description/Example                   |
| --------- | ---------------------- | ------------------------------------- |
| res       | Response               | <p>Response Code <br>200- Success</p> |
| list      | Money Transfer (Array) | Money Transfer List (Array)           |
| count     | Int                    | Total money transfer number by filter |

| Money Transfer (Array) | Type     | Description/Example                                 |
| ---------------------- | -------- | --------------------------------------------------- |
| id                     | Int      | Money Transfer ID                                   |
| status                 | String   | <p>Status </p><p>(Success, Voided)</p>              |
| amount                 | Double   | Amount                                              |
| actiondate             | Date     | <p>Date<br>(yyyy-MM-dd)</p>                         |
| actiondateString       | String   | <p>Date Text </p><p>(yyyy-MM-dd)</p>                |
| fromPaymentMethodId    | Int      | Payment Method ID for transferring money            |
| fromPaymentMethodName  | String   | Payment Method Name for transferring money          |
| toPaymentMethodId      | Int      | Payment Method ID for receiving money               |
| toPaymentMethodName    | String   | Payment Method Name for receiving money             |
| reference              | String   | Reference                                           |
| description            | String   | Description                                         |
| createdatetime         | Datetime | Created Datetime                                    |
| createdatetimeString   | String   | <p>Created Datetime Text <br>(yyyy-MM-dd HH:mm)</p> |
| createuserid           | Int      | Created User ID                                     |
| createusername         | String   | Created User (Username)                             |
| createdby              | String   | Created User (Display name)                         |
| uniquenumber           | String   | Unique Number                                       |
| {% endtab %}           |          |                                                     |
| {% endtabs %}          |          |                                                     |

## Get Money Transfer Detail

<mark style="color:blue;">`GET`</mark> `https://open-api.zortout.com/v4/Finance/GetMoneyTransferDetail`

Get money transfer detail.

#### Query Parameters

| Name                                 | Type | Description       |
| ------------------------------------ | ---- | ----------------- |
| id<mark style="color:red;">\*</mark> | Int  | Money Transfer ID |

#### Headers

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| storename<mark style="color:red;">\*</mark> | String | Store Name  |
| apikey<mark style="color:red;">\*</mark>    | String | API Key     |
| apisecret<mark style="color:red;">\*</mark> | String | API Secret  |

{% tabs %}
{% tab title="Response" %}

| Parameter | Type                  | Description/Example                   |
| --------- | --------------------- | ------------------------------------- |
| res       | Response              | <p>Response Code <br>200- Success</p> |
| list      | MoneyTransfer (Array) | Money Transfer List (Array)           |
| count     | Int                   | Total money transfer number by filter |

| MoneyTransfer (Array) | Type     | Description/Example                                 |
| --------------------- | -------- | --------------------------------------------------- |
| id                    | Int      | Money Transfer ID                                   |
| status                | String   | Status (Success, Voided)                            |
| amount                | Double   | Amount                                              |
| actiondate            | Date     | <p>Date<br>(yyyy-MM-dd)</p>                         |
| actiondateString      | String   | <p>Date Text <br>(yyyy-MM-dd)</p>                   |
| fromPaymentMethodId   | Int      | Payment Method ID for transferring money            |
| fromPaymentMethodName | String   | Payment Method Name for transferring money          |
| toPaymentMethodId     | Int      | Payment Method ID for receiving money               |
| toPaymentMethodName   | String   | Payment Method Name for receiving money             |
| reference             | String   | Reference                                           |
| description           | String   | Description                                         |
| createdatetime        | Datetime | Created Datetime                                    |
| createdatetimeString  | String   | <p>Created Datetime Text <br>(yyyy-MM-dd HH:mm)</p> |
| createuserid          | Int      | Created User ID                                     |
| createusername        | String   | Created User (Username)                             |
| createdby             | String   | Created User (Display name)                         |
| uniquenumber          | String   | Unique Number                                       |
| {% endtab %}          |          |                                                     |
| {% endtabs %}         |          |                                                     |

## Add Money Transfer.

<mark style="color:green;">`POST`</mark> `https://open-api.zortout.com/v4/Finance/AddMoneyTransfer`

Add money transfer.

#### Query Parameters

| Name         | Type   | Description                                                                                 |
| ------------ | ------ | ------------------------------------------------------------------------------------------- |
| uniquenumber | String | <p>Unique Number.</p><p>This value is unique and used to prevent duplicate transaction.</p> |

#### Headers

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| storename<mark style="color:red;">\*</mark> | String | Store Name  |
| apikey<mark style="color:red;">\*</mark>    | String | API Key     |
| apisecret<mark style="color:red;">\*</mark> | String | API Secret  |

{% tabs %}
{% tab title="Response" %}

| Parameter    | Type   | Description/Example                   |
| ------------ | ------ | ------------------------------------- |
| resCode      | String | <p>Response Code <br>200- Success</p> |
| resDesc      | String | Response Description                  |
| {% endtab %} |        |                                       |

{% tab title="Ex. Request JSON" %}

```json
{
    "fromPaymentMethodName": "Cash",
    "toPaymentMethodName": "Credit Card",
    "amount": 100,
    "reference": "Test Reference",
    "actiondate": "2023-08-07",
    "description": "Test Description"
}
```

{% endtab %}
{% endtabs %}


---

# 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://developers.zortout.com/api-reference/finance.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.
