# worksheet_tax_correction

## Description

<details>
<summary><strong>Table Definition</strong></summary>

```sql
CREATE TABLE `worksheet_tax_correction` (
  `worksheet_tax_correction_id` mediumint unsigned NOT NULL AUTO_INCREMENT,
  `contract_id` mediumint unsigned NOT NULL,
  `account_id` mediumint unsigned NOT NULL,
  `correction_statement_period_id` mediumint unsigned NOT NULL,
  `payable_detail_type_id` tinyint unsigned NOT NULL,
  `amount` decimal(20,2) NOT NULL,
  `currency_code` char(3) NOT NULL,
  `note` varchar(255) DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `created_by` varchar(255) NOT NULL,
  `last_modified` datetime NOT NULL,
  `last_modified_by` varchar(255) NOT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `deleted_by` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`worksheet_tax_correction_id`),
  KEY `fk_tc_contract` (`contract_id`),
  KEY `fk_tc_account` (`account_id`),
  KEY `fk_tc_ref_payable_detail` (`payable_detail_type_id`),
  KEY `idx_correction_statement_period_id_contract_id` (`correction_statement_period_id`,`contract_id`),
  CONSTRAINT `fk_tc_account` FOREIGN KEY (`account_id`) REFERENCES `account` (`account_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_tc_contract` FOREIGN KEY (`contract_id`) REFERENCES `contract` (`contract_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_tc_ref_payable_detail` FOREIGN KEY (`payable_detail_type_id`) REFERENCES `reference_payable_detail_type` (`reference_payable_detail_type_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_tc_statement_period` FOREIGN KEY (`correction_statement_period_id`) REFERENCES `statement_period` (`statement_period_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=[Redacted by tbls] DEFAULT CHARSET=utf8mb3
```

</details>

## Columns

| Name                           | Type               | Default | Nullable | Extra Definition | Children | Parents                                                           | Comment |
| ------------------------------ | ------------------ | ------- | -------- | ---------------- | -------- | ----------------------------------------------------------------- | ------- |
| account_id                     | mediumint unsigned |         | false    |                  |          | [account](account.md)                                             |         |
| amount                         | decimal(20,2)      |         | false    |                  |          |                                                                   |         |
| contract_id                    | mediumint unsigned |         | false    |                  |          | [contract](contract.md)                                           |         |
| correction_statement_period_id | mediumint unsigned |         | false    |                  |          | [statement_period](statement_period.md)                           |         |
| created_at                     | datetime           |         | false    |                  |          |                                                                   |         |
| created_by                     | varchar(255)       |         | false    |                  |          |                                                                   |         |
| currency_code                  | char(3)            |         | false    |                  |          |                                                                   |         |
| deleted_at                     | datetime           |         | true     |                  |          |                                                                   |         |
| deleted_by                     | varchar(255)       |         | true     |                  |          |                                                                   |         |
| last_modified                  | datetime           |         | false    |                  |          |                                                                   |         |
| last_modified_by               | varchar(255)       |         | false    |                  |          |                                                                   |         |
| note                           | varchar(255)       |         | true     |                  |          |                                                                   |         |
| payable_detail_type_id         | tinyint unsigned   |         | false    |                  |          | [reference_payable_detail_type](reference_payable_detail_type.md) |         |
| worksheet_tax_correction_id    | mediumint unsigned |         | false    | auto_increment   |          |                                                                   |         |

## Constraints

| Name                     | Type        | Definition                                                                                                       |
| ------------------------ | ----------- | ---------------------------------------------------------------------------------------------------------------- |
| PRIMARY                  | PRIMARY KEY | PRIMARY KEY (worksheet_tax_correction_id)                                                                        |
| fk_tc_account            | FOREIGN KEY | FOREIGN KEY (account_id) REFERENCES account (account_id)                                                         |
| fk_tc_contract           | FOREIGN KEY | FOREIGN KEY (contract_id) REFERENCES contract (contract_id)                                                      |
| fk_tc_ref_payable_detail | FOREIGN KEY | FOREIGN KEY (payable_detail_type_id) REFERENCES reference_payable_detail_type (reference_payable_detail_type_id) |
| fk_tc_statement_period   | FOREIGN KEY | FOREIGN KEY (correction_statement_period_id) REFERENCES statement_period (statement_period_id)                   |

## Indexes

| Name                                           | Definition                                                                                                   |
| ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| PRIMARY                                        | PRIMARY KEY (worksheet_tax_correction_id) USING BTREE                                                        |
| fk_tc_account                                  | KEY fk_tc_account (account_id) USING BTREE                                                                   |
| fk_tc_contract                                 | KEY fk_tc_contract (contract_id) USING BTREE                                                                 |
| fk_tc_ref_payable_detail                       | KEY fk_tc_ref_payable_detail (payable_detail_type_id) USING BTREE                                            |
| idx_correction_statement_period_id_contract_id | KEY idx_correction_statement_period_id_contract_id (correction_statement_period_id, contract_id) USING BTREE |

## Relations

![er](worksheet_tax_correction.svg)

---

> Generated by [tbls](https://github.com/k1LoW/tbls)
