CREATE TABLE `invoice_detail2` (
`id` int(11) NOT NULL,
`office_code` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
`order_type` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'purchase order, sale order, transfer in, transfer out, debit note, credit note',
`in_out_flag` int(1) NOT NULL COMMENT '1=in, 2=out',
`order_no` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
`order_date` date NOT NULL,
`item_no` int(10) NOT NULL,
`item_qty` int(10) NOT NULL,
`item_unit` varchar(5) COLLATE utf8mb4_unicode_ci NOT NULL,
`unit_price_loc` int(12) NOT NULL,
`unit_price_fc` int(12) NOT NULL,
`curr_code` int(5) NOT NULL,
`exch_rate` int(7) NOT NULL,
`total_price_loc` decimal(15,2) NOT NULL,
`total_price_fc` decimal(15,2) NOT NULL,
`include` int(11) NOT NULL,
`includ_vat_tax` varchar(1) COLLATE utf8mb4_unicode_ci NOT NULL,
`bar_code` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`item_origin` varchar(4) COLLATE utf8mb4_unicode_ci NOT NULL,
`item_waranty` int(4) NOT NULL,
`warranty_type` varchar(1) COLLATE utf8mb4_unicode_ci NOT NULL,
`agaunest_indent_no` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
`order_statud` varchar(1) COLLATE utf8mb4_unicode_ci NOT NULL,
`status_date` date NOT NULL,
`status_ref` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`ss_creator` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
`ss_created_on` datetime NOT NULL,
`ss_modifier` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
`ss_modofier_on` date NOT NULL
)PARTITION BY RANGE (month(order_date)) (
PARTITION p0 VALUES LESS THAN (1),
PARTITION p1 VALUES LESS THAN (2),
PARTITION p2 VALUES LESS THAN (3),
PARTITION p3 VALUES LESS THAN (4),
PARTITION p4 VALUES LESS THAN (5),
PARTITION p5 VALUES LESS THAN (6),
PARTITION p6 VALUES LESS THAN (7),
PARTITION p7 VALUES LESS THAN (8),
PARTITION p8 VALUES LESS THAN (9),
PARTITION p9 VALUES LESS THAN (10),
PARTITION p10 VALUES LESS THAN (11),
PARTITION p11 VALUES LESS THAN (12)
);