<?php 
require("php_con.php");

if(isset($_POST['create'])){
	
mysqli_query($connation,"CREATE TABLE barcode_print_details (
 bpd_id int(11) NOT NULL AUTO_INCREMENT,
 bpd_user int(11) NOT NULL,
 bpd_barcode varchar(20) NOT NULL,
 bpd_qty int(11) NOT NULL,
 PRIMARY KEY (bpd_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4");
	
mysqli_query($connation,"CREATE TABLE `barcode_print_details` (
 `bpd_id` int(11) NOT NULL AUTO_INCREMENT,
 `bpd_user` int(11) NOT NULL,
 `bpd_barcode` varchar(20) NOT NULL,
 `bpd_qty` int(11) NOT NULL,
 PRIMARY KEY (`bpd_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4");

mysqli_query($connation,"CREATE TABLE `catogary_list` (
 `catogary_id` int(11) NOT NULL AUTO_INCREMENT,
 `catogary_text` varchar(100) NOT NULL,
 PRIMARY KEY (`catogary_id`),
 UNIQUE KEY `expenses_text` (`catogary_text`)
) ENGINE=InnoDB AUTO_INCREMENT=224 DEFAULT CHARSET=utf8mb4");

mysqli_query($connation,"CREATE TABLE `customer_details` (
 `cs_id` int(11) NOT NULL AUTO_INCREMENT,
 `cs_name` varchar(255) NOT NULL,
 `cs_mobile` varchar(20) NOT NULL,
 `cs_nic` varchar(20) NOT NULL,
 `cs_address` text NOT NULL,
 `cs_add_date` date NOT NULL,
 `cs_add_time` time NOT NULL,
 PRIMARY KEY (`cs_id`),
 UNIQUE KEY `cs_mobile` (`cs_mobile`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4");

mysqli_query($connation,"CREATE TABLE `expenses_category` (
 `expenses_id` int(11) NOT NULL AUTO_INCREMENT,
 `expenses_text` varchar(100) NOT NULL,
 PRIMARY KEY (`expenses_id`),
 UNIQUE KEY `expenses_text` (`expenses_text`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4");

mysqli_query($connation,"CREATE TABLE `expenses_details` (
 `expenses_details_id` int(11) NOT NULL AUTO_INCREMENT,
 `expenses_details_category` int(11) NOT NULL,
 `expenses_details_amount` float NOT NULL,
 `expenses_details_user` int(11) NOT NULL,
 `expenses_details_date` date NOT NULL,
 PRIMARY KEY (`expenses_details_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4");

mysqli_query($connation,"CREATE TABLE `price_details` (
 `price_id` int(11) NOT NULL AUTO_INCREMENT,
 `price_systemid` varchar(50) NOT NULL,
 `price_name` varchar(100) NOT NULL,
 `price_buy` float NOT NULL,
 `price_sale` float NOT NULL,
 `price_wholesale` float NOT NULL,
 `price_discount` float NOT NULL,
 `price_addtime` datetime NOT NULL,
 PRIMARY KEY (`price_id`)
) ENGINE=InnoDB AUTO_INCREMENT=6236 DEFAULT CHARSET=utf8mb4");

mysqli_query($connation,"CREATE TABLE `product_details` (
 `product_id` int(11) NOT NULL AUTO_INCREMENT,
 `product_systemid` varchar(50) NOT NULL,
 `product_barcode` varchar(50) NOT NULL,
 `product_productid` varchar(50) NOT NULL,
 `product_name` varchar(255) NOT NULL,
 `product_name_sinhala` varchar(255) NOT NULL,
 `product_add_discount` tinyint(1) NOT NULL,
 `product_alertqty` int(11) NOT NULL,
 `product_supplier` int(11) NOT NULL,
 `product_catagory` int(11) NOT NULL,
 `product_unit` int(11) NOT NULL,
 `product_stock_maintain` int(11) NOT NULL,
 `product_addtime` datetime NOT NULL,
 PRIMARY KEY (`product_id`),
 UNIQUE KEY `product_barcode` (`product_barcode`),
 UNIQUE KEY `product_productid` (`product_productid`),
 UNIQUE KEY `product_systemid` (`product_systemid`)
) ENGINE=InnoDB AUTO_INCREMENT=6236 DEFAULT CHARSET=utf8mb4");

mysqli_query($connation,"CREATE TABLE `quotation_details` (
 `qd_id` int(11) NOT NULL AUTO_INCREMENT,
 `qd_bill_id` varchar(20) NOT NULL,
 `quotation_cus_name` varchar(255) NOT NULL,
 `quotation_mobile` varchar(20) NOT NULL,
 `quotation_remark` text NOT NULL,
 `qd_c_date` date NOT NULL,
 `qd_c_time` time NOT NULL,
 `qd_user` int(11) NOT NULL,
 PRIMARY KEY (`qd_id`),
 UNIQUE KEY `qd_bill_id` (`qd_bill_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4");

mysqli_query($connation,"CREATE TABLE `return_details` (
 `rd_id` int(11) NOT NULL AUTO_INCREMENT,
 `rd_bill_no` varchar(50) NOT NULL,
 `rd_user` int(11) NOT NULL,
 `rd_add_date` date NOT NULL,
 `rd_add_time` time NOT NULL,
 PRIMARY KEY (`rd_id`),
 UNIQUE KEY `rd_bill_no` (`rd_bill_no`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4");

mysqli_query($connation,"CREATE TABLE `return_list` (
 `rl_id` int(11) NOT NULL AUTO_INCREMENT,
 `rl_bill_no` varchar(50) NOT NULL,
 `rl_product` int(11) NOT NULL,
 `rl_price` float NOT NULL,
 `rl_qty` float NOT NULL,
 PRIMARY KEY (`rl_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4");

mysqli_query($connation,"CREATE TABLE `sale_details` (
 `sale_details_id` int(11) NOT NULL AUTO_INCREMENT,
 `sale_details_billid` varchar(20) NOT NULL,
 `sale_details_cash_payment` float NOT NULL,
 `sale_details_card_payment` float NOT NULL,
 `sale_details_cus_payment` float NOT NULL,
 `sale_details_discount` float NOT NULL,
 `sale_details_user` int(11) NOT NULL,
 `sale_details_customer` varchar(11) NOT NULL,
 `sale_details_date` date NOT NULL,
 `sale_details_time` time NOT NULL,
 PRIMARY KEY (`sale_details_id`),
 UNIQUE KEY `sale_details_billid` (`sale_details_billid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4");

mysqli_query($connation,"CREATE TABLE `sale_list` (
 `sale_id` int(11) NOT NULL AUTO_INCREMENT,
 `sale_billid` varchar(20) NOT NULL,
 `sale_barcode` varchar(20) NOT NULL,
 `sale_other_info` varchar(255) NOT NULL,
 `sale_buy_price` float NOT NULL,
 `sale_real_sale_price` float NOT NULL,
 `sale_saleprice` float NOT NULL,
 `sale_qty` float NOT NULL,
 PRIMARY KEY (`sale_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4");

mysqli_query($connation,"CREATE TABLE `setting` (
 `setting_id` int(11) NOT NULL AUTO_INCREMENT,
 `setting_text` varchar(50) NOT NULL,
 `setting_value` text NOT NULL,
 PRIMARY KEY (`setting_id`),
 UNIQUE KEY `setting_text` (`setting_text`)
) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8mb4");

mysqli_query($connation,"CREATE TABLE `start_balance_details` (
 `Start_balance_id` int(11) NOT NULL AUTO_INCREMENT,
 `Start_balance_date` date NOT NULL,
 `Start_balance_start_amount` float DEFAULT NULL,
 `Start_balance_end_amount` float DEFAULT NULL,
 `Start_balance_start_user` int(11) DEFAULT NULL,
 `Start_balance_end_time` datetime DEFAULT NULL,
 `Start_balance_status` int(11) NOT NULL,
 PRIMARY KEY (`Start_balance_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4");

mysqli_query($connation,"CREATE TABLE `stock_count` (
 `sc_id` int(11) NOT NULL AUTO_INCREMENT,
 `sc_date` date NOT NULL,
 `sc_select_cat` varchar(10) NOT NULL,
 `sc_user` int(11) NOT NULL,
 `sc_status` int(11) NOT NULL,
 `sc_c_date` date NOT NULL,
 `sc_c_time` time NOT NULL,
 PRIMARY KEY (`sc_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4");

mysqli_query($connation,"CREATE TABLE `stock_count_list` (
 `scl_id` int(11) NOT NULL AUTO_INCREMENT,
 `scl_details_id` int(11) NOT NULL,
 `scl_product` int(11) NOT NULL,
 `scl_system_qty` float NOT NULL,
 `scl_count_qty` float NOT NULL,
 PRIMARY KEY (`scl_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4");

mysqli_query($connation,"CREATE TABLE `stock_details` (
 `stock_id` int(11) NOT NULL AUTO_INCREMENT,
 `stock_systemid` varchar(50) NOT NULL,
 `stock_bill_id` varchar(20) NOT NULL,
 `stock_qty` float NOT NULL,
 `stock_type` tinyint(1) NOT NULL,
 `stock_info` varchar(255) NOT NULL,
 `stock_addtime` datetime NOT NULL,
 PRIMARY KEY (`stock_id`)
) ENGINE=InnoDB AUTO_INCREMENT=6236 DEFAULT CHARSET=utf8mb4");

mysqli_query($connation,"CREATE TABLE `supplier_bill_details` (
 `supplier_bill_details_id` int(11) NOT NULL AUTO_INCREMENT,
 `supplier_bill_details_system_id` varchar(20) NOT NULL,
 `supplier_bill_details_create_user` int(11) NOT NULL,
 `supplier_bill_details_supplier` int(11) NOT NULL,
 `supplier_bill_details_billnumber` varchar(20) NOT NULL,
 `supplier_bill_details_create_date` date NOT NULL,
 `supplier_bill_details_close_status` int(11) NOT NULL,
 `supplier_bill_details_due_date` date NOT NULL,
 `supplier_bill_details_close_remark` text NOT NULL,
 PRIMARY KEY (`supplier_bill_details_id`),
 UNIQUE KEY `supplier_bill_details_system_id` (`supplier_bill_details_system_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4");

mysqli_query($connation,"CREATE TABLE `supplier_details` (
 `supplier_id` int(11) NOT NULL AUTO_INCREMENT,
 `supplier_name` varchar(100) NOT NULL,
 `supplier_mobile` varchar(10) NOT NULL,
 `supplier_company` varchar(255) NOT NULL,
 `supplier_address` text NOT NULL,
 PRIMARY KEY (`supplier_id`),
 UNIQUE KEY `supplier_name` (`supplier_name`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4");

mysqli_query($connation,"CREATE TABLE `supplier_payment` (
 `sp_id` int(11) NOT NULL AUTO_INCREMENT,
 `sp_supplier_id` int(11) NOT NULL,
 `sp_pay_user` int(11) NOT NULL,
 `sp_payment_info` text NOT NULL,
 `sp_amount` float NOT NULL,
 `sp_add_date` date NOT NULL,
 `sp_add_time` time NOT NULL,
 PRIMARY KEY (`sp_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4");

mysqli_query($connation,"CREATE TABLE `supp_bill_list` (
 `supp_bill_id` int(11) NOT NULL AUTO_INCREMENT,
 `supp_bill_system_id` varchar(20) NOT NULL,
 `supp_bill_product_id` varchar(50) NOT NULL,
 `supp_bill_badge_id` int(11) NOT NULL,
 `supp_bill_buy_price` float NOT NULL,
 `supp_bill_sale_price` float NOT NULL,
 `supp_bill_wholesale` float NOT NULL,
 `supp_bill_discount_price` float NOT NULL,
 `supp_bill_qty` int(11) NOT NULL,
 PRIMARY KEY (`supp_bill_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4");

mysqli_query($connation,"CREATE TABLE `unit_list` (
 `unit_id` int(11) NOT NULL AUTO_INCREMENT,
 `unit_text` varchar(50) NOT NULL,
 PRIMARY KEY (`unit_id`),
 UNIQUE KEY `expenses_text` (`unit_text`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4");

mysqli_query($connation,"CREATE TABLE `user_details` (
 `user_id` int(11) NOT NULL AUTO_INCREMENT,
 `user_username` varchar(100) NOT NULL,
 `user_password` varchar(255) NOT NULL,
 `user_fname` varchar(255) NOT NULL,
 `user_lname` varchar(255) NOT NULL,
 `user_type` int(11) NOT NULL,
 `user_reg_time` datetime NOT NULL,
 PRIMARY KEY (`user_id`),
 UNIQUE KEY `user_username` (`user_username`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4");
	
}
?>

<form method="post">
	<button type="submit" name="create">Create Table</button>
</form>