Profit Loss Categories 
This module is used to seperate profit loss items by category.
INFO
 Make sure to add /api prefix in the API endpoint. 
Get Profit Loss Categories Endpoint 
http
GET /mstRootsGET /mstRootsHeaders 
- Content-Type: application/json
 - Authorization: Bearer {token}
 
Query Parameter 
| Name | Type | Description | Nullable | 
|---|---|---|---|
| page | int | Page number | false | 
Response 
200 OK
json
{
    "data": {
        "data": [
            {
                "id": 2,
                "name": "LABA KOTOR USAHA",
                "parent_name": "(1) Utama",
                "is_deletable": 0,
                "is_mandatory": null
            },
            {
                "id": 11,
                "name": "BEBAN USAHA",
                "parent_name": "(1) Utama",
                "is_deletable": 0,
                "is_mandatory": null
            },
            {
                "id": 22,
                "name": "KERUGIAN PERSEDIAAN BBM AKIBAT PENURUNAN HARGA BBM",
                "parent_name": "(1) Utama",
                "is_deletable": 0,
                "is_mandatory": null
            },
            // and so on...
        ]
    }
}{
    "data": {
        "data": [
            {
                "id": 2,
                "name": "LABA KOTOR USAHA",
                "parent_name": "(1) Utama",
                "is_deletable": 0,
                "is_mandatory": null
            },
            {
                "id": 11,
                "name": "BEBAN USAHA",
                "parent_name": "(1) Utama",
                "is_deletable": 0,
                "is_mandatory": null
            },
            {
                "id": 22,
                "name": "KERUGIAN PERSEDIAAN BBM AKIBAT PENURUNAN HARGA BBM",
                "parent_name": "(1) Utama",
                "is_deletable": 0,
                "is_mandatory": null
            },
            // and so on...
        ]
    }
}403 Forbidden
json
{
    "message": "Unauthorized"
}{
    "message": "Unauthorized"
}404 Not Found
json
{
    "message": "Data tidak ditemukan"
}{
    "message": "Data tidak ditemukan"
}Used on pages 
/profitloss
Create Profit Loss Category Endpoint 
http
POST /mstRootsPOST /mstRootsHeaders 
- Content-Type: application/json
 - Authorization: Bearer {token}
 
Body 
JSON Body
json
{
    "name": "Pembayaran ABC",
    "mst_root_id": 11
}{
    "name": "Pembayaran ABC",
    "mst_root_id": 11
}| Name | Type | Description | Nullable | 
|---|---|---|---|
| name | string | Profit Loss Category Name | false | 
| mst_root_id | int | Parent Profit Loss Category ID | false | 
Response 
200 OK
json
{
    "message": "Berhasil menambahkan Kategori Laba Rugi",
}{
    "message": "Berhasil menambahkan Kategori Laba Rugi",
}403 Forbidden
json
{
    "message": "Unauthorized"
}{
    "message": "Unauthorized"
}422 Unprocessable Entity
json
{
    "message": "The given data was invalid.",
    "errors": {
        "name": [
            "The name field is required."
        ],
        "mst_root_id": [
            "The mst root id field is required."
        ]
    }
}{
    "message": "The given data was invalid.",
    "errors": {
        "name": [
            "The name field is required."
        ],
        "mst_root_id": [
            "The mst root id field is required."
        ]
    }
}Used on pages 
/profitloss
Update Profit Loss Category Endpoint 
http
PUT /mstRoots/{id}PUT /mstRoots/{id}Headers 
- Content-Type: application/json
 - Authorization: Bearer {token}
 
Path Variable 
| Name | Type | Description | 
|---|---|---|
| id | int | Profit Loss Category ID | 
Body 
JSON Body
json
{
    "name": "Pembayaran ABCD",
    "mst_root_id": 11
}{
    "name": "Pembayaran ABCD",
    "mst_root_id": 11
}| Name | Type | Description | Nullable | 
|---|---|---|---|
| name | string | Profit Loss Category Name | false | 
| mst_root_id | int | Parent Profit Loss Category ID | false | 
Response 
200 OK
json
{
    "message": "Berhasil mengubah Kategori Laba Rugi",
}{
    "message": "Berhasil mengubah Kategori Laba Rugi",
}403 Forbidden
json
{
    "message": "Unauthorized"
}{
    "message": "Unauthorized"
}422 Unprocessable Entity
json
{
    "message": "The given data was invalid.",
    "errors": {
        "name": [
            "The name field is required."
        ],
        "mst_root_id": [
            "The mst root id field is required."
        ]
    }
}{
    "message": "The given data was invalid.",
    "errors": {
        "name": [
            "The name field is required."
        ],
        "mst_root_id": [
            "The mst root id field is required."
        ]
    }
}Used on pages 
/profitloss
Delete Profit Loss Category Endpoint 
http
DELETE /mstRoots/{id}DELETE /mstRoots/{id}Headers 
- Content-Type: application/json
 - Authorization: Bearer {token}
 
Path Variable 
| Name | Type | Description | 
|---|---|---|
| id | int | Profit Loss Category ID | 
Response 
200 OK
json
{
    "message": "Berhasil menghapus Kategori Laba Rugi",
}{
    "message": "Berhasil menghapus Kategori Laba Rugi",
}403 Forbidden
json
{
    "message": "Unauthorized"
}{
    "message": "Unauthorized"
}Used on pages 
/profitloss
Get Profit Loss Category Options Endpoint 
http
GET /mst_root/selectGET /mst_root/selectHeaders 
- Content-Type: application/json
 - Authorization: Bearer {token}
 
Response 
200 OK
json
{
    "data": [
        {
            "id": 2,
            "text": "LABA KOTOR USAHA"
        },
        {
            "id": 11,
            "text": "BEBAN USAHA"
        }
    ]
}{
    "data": [
        {
            "id": 2,
            "text": "LABA KOTOR USAHA"
        },
        {
            "id": 11,
            "text": "BEBAN USAHA"
        }
    ]
}403 Forbidden
json
{
    "message": "Unauthorized"
}{
    "message": "Unauthorized"
}Used on pages 
/profitloss
Get Profit Loss Category Options to delete profit losses Endpoint 
http
GET /mst_root/delete/selectGET /mst_root/delete/selectHeaders 
- Content-Type: application/json
 - Authorization: Bearer {token}
 
Query Parameter 
| Name | Type | Description | Nullable | 
|---|---|---|---|
| search_periode_start_at | string | Search by periode start at | false | 
| search_periode_end_at | string | Search by periode end at | false | 
Response 
200 OK
json
{
    "data": [
        {
            "id": 2,
            "text": "LABA KOTOR USAHA"
        },
        {
            "id": 11,
            "text": "BEBAN USAHA"
        },
        {
            "id": 22,
            "text": "KERUGIAN PERSEDIAAN BBM AKIBAT PENURUNAN HARGA BBM"
        }
    ]
}{
    "data": [
        {
            "id": 2,
            "text": "LABA KOTOR USAHA"
        },
        {
            "id": 11,
            "text": "BEBAN USAHA"
        },
        {
            "id": 22,
            "text": "KERUGIAN PERSEDIAAN BBM AKIBAT PENURUNAN HARGA BBM"
        }
    ]
}403 Forbidden
json
{
    "message": "Unauthorized"
}{
    "message": "Unauthorized"
}Used on pages 
/profitloss