-- phpMyAdmin SQL Dump
-- version 3.4.9
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Feb 08, 2017 at 02:34 PM
-- Server version: 5.0.51
-- PHP Version: 5.2.6

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `etldoc_30092014`
--

-- --------------------------------------------------------

--
-- Table structure for table `emp_employment`
--

DROP TABLE IF EXISTS `emp_employment`;
CREATE TABLE IF NOT EXISTS `emp_employment` (
  `employment_id` int(10) unsigned NOT NULL auto_increment,
  `emp_id` int(10) unsigned default NULL,
  `orgunitid` int(10) unsigned default NULL,
  `position_id` int(10) unsigned default NULL,
  `startdate` date default NULL,
  `probationday` int(11) default NULL,
  `hiredate` date default NULL,
  `workingstatus` int(11) default NULL,
  PRIMARY KEY  (`employment_id`),
  KEY `orgunitid` (`orgunitid`),
  KEY `position_id` (`position_id`),
  KEY `emp_id` (`emp_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=52 ;

--
-- Dumping data for table `emp_employment`
--

INSERT INTO `emp_employment` (`employment_id`, `emp_id`, `orgunitid`, `position_id`, `startdate`, `probationday`, `hiredate`, `workingstatus`) VALUES
(1, 1, 1, 1, NULL, NULL, '0000-00-00', 0),
(2, 2, 1, 2, NULL, NULL, '0000-00-00', 1),
(3, 3, 6, 3, NULL, NULL, '0000-00-00', 1),
(4, 4, 2, 3, NULL, NULL, '0000-00-00', 1),
(5, 6, 3, 3, NULL, NULL, '0000-00-00', 1),
(6, 7, 2, 4, NULL, NULL, '0000-00-00', 1),
(7, 8, 4, 3, NULL, NULL, '0000-00-00', 1),
(8, 41, 5, 3, NULL, NULL, '0000-00-00', 1),
(9, 37, 13, NULL, NULL, NULL, '0000-00-00', 1),
(10, 30, 13, NULL, NULL, NULL, '0000-00-00', 1),
(11, 42, 10, NULL, NULL, NULL, '0000-00-00', 1),
(12, 45, 10, NULL, NULL, NULL, '0000-00-00', 1),
(13, 36, 14, 6, NULL, NULL, '0000-00-00', 1),
(14, 32, 14, NULL, NULL, NULL, '0000-00-00', 1),
(15, 5, 11, 5, NULL, NULL, '0000-00-00', 1),
(16, 9, 7, 5, NULL, NULL, '0000-00-00', 1),
(17, 10, 8, 5, NULL, NULL, '0000-00-00', 1),
(18, 11, 17, 5, NULL, NULL, '0000-00-00', 1),
(19, 12, 12, 5, NULL, NULL, '0000-00-00', 0),
(20, 14, 9, 5, NULL, NULL, '0000-00-00', 1),
(21, 15, 15, 5, NULL, NULL, '0000-00-00', 1),
(22, 16, 16, 5, NULL, NULL, '0000-00-00', 1),
(23, 17, 32, 5, NULL, NULL, '0000-00-00', 1),
(24, 18, 8, NULL, NULL, NULL, '0000-00-00', 1),
(25, 19, 17, NULL, NULL, NULL, '0000-00-00', 1),
(26, 20, 13, 5, NULL, NULL, '0000-00-00', 1),
(27, 21, 11, NULL, NULL, NULL, '0000-00-00', 1),
(28, 22, 33, 5, NULL, NULL, '0000-00-00', 1),
(29, 23, 15, NULL, NULL, NULL, '0000-00-00', 1),
(30, 24, 12, NULL, NULL, NULL, '0000-00-00', 1),
(31, 25, 12, 5, NULL, NULL, '0000-00-00', 1),
(32, 26, 12, NULL, NULL, NULL, '0000-00-00', 1),
(33, 27, 16, NULL, NULL, NULL, '0000-00-00', 0),
(34, 28, 34, 5, NULL, NULL, '0000-00-00', 1),
(35, 29, 17, NULL, NULL, NULL, '0000-00-00', 1),
(36, 31, 9, NULL, NULL, NULL, '0000-00-00', 1),
(37, 33, 14, NULL, NULL, NULL, '0000-00-00', 1),
(38, 34, 10, 5, NULL, NULL, '0000-00-00', 1),
(39, 35, 7, NULL, NULL, NULL, '0000-00-00', 1),
(40, 38, 34, NULL, NULL, NULL, '0000-00-00', 1),
(41, 40, 17, NULL, NULL, NULL, '0000-00-00', 1),
(42, 43, 11, NULL, NULL, NULL, '0000-00-00', 1),
(43, 44, 9, NULL, NULL, NULL, '0000-00-00', 1),
(44, 39, 32, NULL, NULL, NULL, '0000-00-00', 1),
(45, 47, 8, NULL, NULL, NULL, '0000-00-00', 1),
(46, 46, 10, NULL, NULL, NULL, '0000-00-00', 1),
(47, 48, 12, NULL, NULL, NULL, '0000-00-00', 1),
(48, 13, 14, 5, NULL, NULL, '0000-00-00', 0),
(49, 49, 0, NULL, NULL, NULL, '0000-00-00', 1),
(50, 50, 32, NULL, NULL, NULL, '0000-00-00', 1),
(51, 51, 1, 1, NULL, NULL, '0000-00-00', 1);

-- --------------------------------------------------------

--
-- Table structure for table `emp_personal`
--

DROP TABLE IF EXISTS `emp_personal`;
CREATE TABLE IF NOT EXISTS `emp_personal` (
  `emp_id` int(10) unsigned NOT NULL auto_increment,
  `emp_code` varchar(20) default NULL,
  `title` varchar(100) default NULL,
  `name` varchar(255) default NULL,
  `surname` varchar(255) default NULL,
  `title_eng` varchar(100) default NULL,
  `name_eng` varchar(255) default NULL,
  `surname_eng` varchar(255) default NULL,
  `nickname` varchar(255) default NULL,
  `email_address` varchar(100) default NULL,
  `tel` varchar(20) default NULL,
  `gender` varchar(50) default NULL,
  `birth_date` date default NULL,
  `birth_village` varchar(200) default NULL,
  `birth_district` varchar(200) default NULL,
  `birth_province` varchar(200) default NULL,
  `born_add` text,
  `address` text,
  `tribe` varchar(255) default NULL,
  `religion` varchar(255) default NULL,
  `status` text,
  `hobby` text,
  `free_t` text,
  `pe_id` text,
  `pass_id` text,
  `remark` text,
  `edu` text,
  `edu_place` text,
  `description` text,
  `respon` text,
  `cal_code` text,
  `party_date` date default NULL,
  `young_date` date default NULL,
  `labor_date` date default NULL,
  `deputy_party_date` date default NULL,
  `women_date` date default NULL,
  `old_specialist` text,
  `record_date` date default NULL,
  `status_per` text,
  `status_birthdate` date default NULL,
  `status_w_place` text,
  `status_w` text,
  `child_n` text,
  `picture` varchar(225) default NULL,
  PRIMARY KEY  (`emp_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `emp_position`
--

DROP TABLE IF EXISTS `emp_position`;
CREATE TABLE IF NOT EXISTS `emp_position` (
  `position_id` int(10) unsigned NOT NULL auto_increment,
  `position_name` varchar(255) default NULL,
  `position_name_eng` varchar(255) default NULL,
  `isdeleted` int(11) default '0',
  `inactive` int(11) default '0',
  PRIMARY KEY  (`position_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=9 ;

--
-- Dumping data for table `emp_position`
--

INSERT INTO `emp_position` (`position_id`, `position_name`, `position_name_eng`, `isdeleted`, `inactive`) VALUES
(1, 'ຫົວຫນ້າພະແນກ', 'Division Manager', 0, 0),
(2, 'ຮອງ ຫົວຫນ້າພະແນກ', 'Deputy of Division Manager', 0, 0),
(3, 'ຫົວຫນ້າພາກສ່ວນ', 'Section Manager', 0, 0),
(4, 'ຮອງ ຫົວຫນ້າພາກສ່ວນ', 'Deputy of Section Manager', 0, 0),
(5, 'ຫົວຫນ້າຫນ່ວຍງານ', 'Chief of Unit', 0, 0),
(6, 'ຮອງ ຫົວຫນ້າຫນ່ວຍງານ', 'Deputy of Chief Unit', 0, 0),
(7, 'ຫົວໜ້າສູນ', '', 1, 0),
(8, 'ຫົວຫນ້ ດດ', '165645670', 1, 0);

-- --------------------------------------------------------

--
-- Table structure for table `organization`
--

DROP TABLE IF EXISTS `organization`;
CREATE TABLE IF NOT EXISTS `organization` (
  `orgid` int(10) unsigned NOT NULL auto_increment,
  `orgname` varchar(255) default NULL,
  `orgnameeng` varchar(255) default NULL,
  PRIMARY KEY  (`orgid`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;

--
-- Dumping data for table `organization`
--

INSERT INTO `organization` (`orgid`, `orgname`, `orgnameeng`) VALUES
(1, 'ບໍລິສັດ ອີທີແອລ ມະຫາຊົນ', 'ETL');

-- --------------------------------------------------------

--
-- Table structure for table `orgunit`
--

DROP TABLE IF EXISTS `orgunit`;
CREATE TABLE IF NOT EXISTS `orgunit` (
  `orgunitid` int(10) unsigned NOT NULL auto_increment,
  `orgunitname` varchar(255) default NULL,
  `orgunitnameeng` varchar(255) default NULL,
  `short_name` varchar(50) default NULL,
  `parentunit` int(11) default NULL,
  `isdeleted` int(11) default '0',
  `inactive` int(11) default '0',
  `unittypeid` int(10) unsigned default NULL,
  PRIMARY KEY  (`orgunitid`),
  KEY `unittypeid` (`unittypeid`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=58 ;

--
-- Dumping data for table `orgunit`
--

INSERT INTO `orgunit` (`orgunitid`, `orgunitname`, `orgunitnameeng`, `short_name`, `parentunit`, `isdeleted`, `inactive`, `unittypeid`) VALUES
(1, 'ພະແນກ ໄອຊີທີ', 'ICT Division', 'ICT', 0, 0, 0, 1),
(18, 'ພະແນກ ການຕະຫຼາດ', 'Marketing Devision', '', 0, 0, 0, 1),
(19, 'ພະແນກໂທລະສັບ-ອີນເຕີເນັດ', NULL, NULL, 0, 0, 0, 1),
(20, 'ພະແນກເລຂານຸການ', NULL, NULL, 0, 1, 0, 1),
(21, 'ພະແນກ ພັດທະນາໂທລະຄົມ', '', '', 0, 0, 0, 1),
(22, 'ພະແນກ ໂທລະສັບມືຖື', '', '', 0, 0, 0, 1),
(23, 'ພະແນກ ບັນຊີ', '', '', 0, 0, 0, 1),
(24, 'ພະແນກ ຈັດຕັ້ງ-ພະນັກງານ', '', '', 0, 0, 0, 1),
(25, 'ພະແນກ ບໍລິຫານ', '', '', 0, 0, 0, 1),
(26, 'ພະແນກ ພົວພັນພາຍໃນ-ຕ່າງປະເທດ', NULL, NULL, 0, 0, 0, 1),
(27, 'ພະແນກ ການເງີນ', '', '', 0, 0, 0, 1),
(28, 'ພະແນກ ກວດກາພາຍໃນ', NULL, NULL, 0, 0, 0, 1),
(29, 'ພະແນກ ນິຕິກໍາ', NULL, NULL, 0, 0, 0, 1),
(30, 'ພະແນກ ສາຍສົ່ງ', '', '', 0, 0, 0, 1),
(31, 'ເຄົາເຕີ', 'counter', '', 25, 0, 0, 4),
(32, 'ຫນ່ວຍງານ ຂໍ້ມູນສ່ວນແບ່ງ', NULL, NULL, 2, 1, 0, 4),
(33, 'ຫນ່ວຍງານ ລະບົບບໍລິການ', NULL, NULL, 4, 1, 0, 4),
(34, 'ໜ່ວຍງານ ບໍລິຫານຄວາມສ່ຽງ', 'Fraud Management Unit', '', 2, 1, 0, 4),
(35, 'ຫ້ອງ ເລຂາ', 'secretary room', '', 25, 0, 0, 4),
(36, 'ອທອ ສາຂາ ຂ.ວຽງຈັນ', 'Vientiane Province', '', 0, 0, 0, 2),
(37, 'ອທອ ສາຂາ ຂ.ຜົ້ງສາລີ', 'Phongsaly Pro.', '', 0, 0, 0, 2),
(38, 'ອທອ ສາຂາ ຂ.ອຸດົມໄຊ', 'Oudomxay Pro.', '', 0, 0, 0, 2),
(39, 'ອທອ ສາຂາ ຂ.ຫຼວງນ້ຳທາ', 'Luangnamtha Pro.', '', 0, 0, 0, 2),
(40, 'ອທອ ສາຂາ ຂ.ບໍ່ແກ້ວ', 'Borkeo Pro.', '', 0, 0, 0, 2),
(41, 'ອທອ ສາຂາ ຂ.ຫຼວງພະບາງ', 'Luangprabang Pro.', '', 0, 0, 0, 2),
(42, 'ອທອ ສາຂາ ຂ.ໄຊຍະບູລີ', 'Xayyabouly Pro.', '', 0, 0, 0, 2),
(43, 'ອທອ ສາຂາ ຂ.ຊຽງຂວາງ', 'Xiengkhuang Pro.', '', 0, 0, 0, 2),
(44, 'ອທອ ສາຂາ ຂ.ຫົວພັນ', 'Huaphane Pro.', '', 0, 0, 0, 2),
(45, 'ອທອ ສາຂາ ຂ.ບໍລິຄຳໄຊ', 'Borlikhamxay Pro.', '', 0, 0, 0, 2),
(46, 'ອທອ ສາຂາ ຂ.ຄຳມ່ວນ', 'Khammouane Pro.', '', 0, 0, 0, 2),
(47, 'ອທອ ສາຂາ ຂ.ສະຫວັນນະເຂດ', 'Savanhnakhet Pro.', '', 0, 0, 0, 2),
(48, 'ອທອ ສາຂາ ຂ.ສາລະວັນ', 'Saravanh Pro.', '', 0, 0, 0, 2),
(49, 'ອທອ ສາຂາ ຂ.ຈຳປາສັກ', 'Champasak Pro.', '', 0, 0, 0, 2),
(50, 'ອທອ ສາຂາ ຂ.ເຊກອງ', 'Sekong Pro.', '', 0, 0, 0, 2),
(51, 'ອທອ ສາຂາ ຂ.ອັດຕະປື', 'Attapue Pro.', '', 0, 0, 0, 2),
(52, 'ຫົວໜ້າ ຄະນະຮັບຜິດຊອບຄຸ້ມຄອງບໍລິຫານ', '', 'ທ່ານ ສົມບຸນ', 0, 0, 0, 5),
(53, 'ຮອງຫົວໜ້າ ຄະນະຮັບຜິດຊອບຄຸ້ມຄອງບໍລິຫານ', '', 'ທ່ານ ເຄນລັງສີ', 0, 0, 0, 5),
(54, 'ຜູ້ຊ່ວຍວຽກຄະນະຮັບຜິດຊອບຄຸ້ມຄອງບໍລິຫານ', '', 'ທ່ານ ທະວີສັກ', 0, 0, 0, 5),
(55, 'ຄະນະຮັບຜິດຊອບຄຸ້ມຄອງບໍລິຫານ, ດ້ານບໍລິຫານ', '', 'ທ່ານ ຄໍາຮຸ່ງ', 0, 0, 0, 5),
(56, 'ຄະນະຮັບຜິດຊອບຄຸ້ມຄອງບໍລິຫານ, ດ້ານທຸລະກິດ', '', 'ທ່ານ ສີສະຫວາດ', 0, 0, 0, 5),
(57, 'ອທອ ສາຂາ ຂ.ໄຊສົມບູນ', 'Xaisomboune Pro', '', 0, 0, 0, 2);

-- --------------------------------------------------------

--
-- Table structure for table `orgunittype`
--

DROP TABLE IF EXISTS `orgunittype`;
CREATE TABLE IF NOT EXISTS `orgunittype` (
  `unittypeid` int(10) unsigned NOT NULL auto_increment,
  `unittypename` varchar(255) default NULL,
  `unittypenameeng` varchar(255) default NULL,
  `orgid` int(10) unsigned default NULL,
  `isdeleted` int(11) default '0',
  `inactive` int(11) default '0',
  PRIMARY KEY  (`unittypeid`),
  KEY `orgid` (`orgid`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=7 ;

--
-- Dumping data for table `orgunittype`
--

INSERT INTO `orgunittype` (`unittypeid`, `unittypename`, `unittypenameeng`, `orgid`, `isdeleted`, `inactive`) VALUES
(1, 'ພະແນກ', 'Manger of Division', 1, 0, 0),
(2, 'ສາຂາ', 'branch', 1, 0, 0),
(3, 'ພາກສ່ວນ', 'section', 1, 0, 0),
(4, 'ຫນ່ວຍງານ', 'Unit', 1, 0, 0),
(5, 'ອໍານວຍການ', NULL, NULL, 0, 0),
(6, '', NULL, NULL, 1, 0);

-- --------------------------------------------------------

--
-- Table structure for table `sys_user`
--

DROP TABLE IF EXISTS `sys_user`;
CREATE TABLE IF NOT EXISTS `sys_user` (
  `sysuserid` int(10) unsigned NOT NULL auto_increment,
  `emp_code` int(10) unsigned default NULL,
  `username` varchar(100) default NULL,
  `password` varchar(100) default NULL,
  `first_name` varchar(255) default NULL,
  `last_name` varchar(255) default NULL,
  `orgunitid` int(11) default NULL,
  `position_id` int(11) default NULL,
  `email_address` varchar(255) default NULL,
  `createby` int(11) default NULL,
  `createdate` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
  `role_id` int(11) NOT NULL,
  `sys_type` enum('none','counter','secretary') default NULL,
  `isdeleted` int(11) default '0',
  `isinactive` int(11) default '0',
  PRIMARY KEY  (`sysuserid`),
  KEY `emp_id` (`emp_code`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=55 ;

--
-- Dumping data for table `sys_user`
--

INSERT INTO `sys_user` (`sysuserid`, `emp_code`, `username`, `password`, `first_name`, `last_name`, `orgunitid`, `position_id`, `email_address`, `createby`, `createdate`, `role_id`, `sys_type`, `isdeleted`, `isinactive`) VALUES
(1, 0, 'admin', '202cb962ac59075b964b07152d234b70', 'admin', '', 0, 0, '', 1, '2017-02-08 07:14:27', 1, 'none', 0, 0),
(4, 0, 'counter', '202cb962ac59075b964b07152d234b70', 'counter', 'counter', 31, 0, '', 1, '2017-02-08 07:33:56', 1, 'counter', 0, 0),
(5, 0, 'secure', '202cb962ac59075b964b07152d234b70', 'secure', 'secure', 35, NULL, '', 1, '2017-02-08 07:34:06', 1, 'secretary', 0, 0),
(28, 0, 'luangprabang', '7271a5185a020d95b8a66bbda53ec8d2', 'ອທອ ຂ. ຫຼວງພະບາງ', 'luangphabang', 41, NULL, '', 1, '2014-08-01 06:25:41', 1, 'none', 0, 0);

-- --------------------------------------------------------

--
-- Table structure for table `tbl_doctype`
--

DROP TABLE IF EXISTS `tbl_doctype`;
CREATE TABLE IF NOT EXISTS `tbl_doctype` (
  `doctype_id` int(11) NOT NULL auto_increment,
  `doctype_name` text,
  PRIMARY KEY  (`doctype_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=36 ;

--
-- Dumping data for table `tbl_doctype`
--

INSERT INTO `tbl_doctype` (`doctype_id`, `doctype_name`) VALUES
(1, 'ໃບແຈ້ງການ'),
(2, 'ໃບສະເໜີ'),
(3, 'ໃບລາຍງານ'),
(4, 'ໃບຢັ້ງຢືນ'),
(5, 'ຂໍ້ຕົກລົງ'),
(6, 'ແຜນສົ່ງເສີມ'),
(7, 'ບົດບັນທຶກ'),
(8, 'ໃບສະເໜີລາຄາ'),
(9, 'PO'),
(10, 'Contract'),
(11, 'ຄໍາສັ່ງປະຕິບັດງານ'),
(12, 'ໃບດັດແກ້ສັນຍາ'),
(13, 'ໃບຄໍາຮ້ອງ'),
(14, 'ໃບເດີນທາງ'),
(15, 'ບົດສະຫຼຸບ'),
(16, 'ໃບນໍາສົ່ງ'),
(17, 'ສະໂນດນໍາສົ່ງ'),
(18, 'ຂໍ້ກໍານົດ'),
(19, 'ພາລະບົດບາດ'),
(20, 'ໃບຄໍ້າປະກັນ'),
(21, 'Letter'),
(22, 'Quotation'),
(23, 'Fax'),
(24, 'ໃບສັ່ງຊື້'),
(25, 'Invoice'),
(26, 'ໃບມອບສິດ'),
(27, 'ບົດລາຍງານ'),
(28, 'ໃບແຈ້ງຕອບ'),
(29, 'ບັດເຊີນ'),
(30, 'ເອກະສານອື່ນໆ'),
(31, 'Clear AD'),
(32, 'ໃບກິດສໍາພັນ'),
(33, 'ໃບເບີກຈ່າຍ'),
(34, 'ໃບສັນຍາ'),
(35, 'ໃບຂໍສ້ອມແປງ');

-- --------------------------------------------------------

--
-- Table structure for table `tbl_doc_io_type`
--

DROP TABLE IF EXISTS `tbl_doc_io_type`;
CREATE TABLE IF NOT EXISTS `tbl_doc_io_type` (
  `doc_io_id` int(10) unsigned NOT NULL auto_increment,
  `io_name` text,
  PRIMARY KEY  (`doc_io_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;

--
-- Dumping data for table `tbl_doc_io_type`
--

INSERT INTO `tbl_doc_io_type` (`doc_io_id`, `io_name`) VALUES
(1, 'ຂາເຂົ້າພາຍໃນບໍລິສັດ'),
(2, 'ຂາເຂົ້າພາຍໃນຕ່າງແຂວງ'),
(3, 'ຂາເຂົ້າພາຍນອກ');

-- --------------------------------------------------------

--
-- Table structure for table `tbl_his_comment`
--

DROP TABLE IF EXISTS `tbl_his_comment`;
CREATE TABLE IF NOT EXISTS `tbl_his_comment` (
  `his_id` bigint(20) unsigned NOT NULL auto_increment,
  `doc_id` bigint(20) unsigned default NULL,
  `orgunitid` int(10) unsigned default NULL,
  `comment` text NOT NULL,
  `m_date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
  `sysuserid` int(11) NOT NULL,
  PRIMARY KEY  (`his_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `tbl_in_out_document`
--

DROP TABLE IF EXISTS `tbl_in_out_document`;
CREATE TABLE IF NOT EXISTS `tbl_in_out_document` (
  `doc_id` bigint(20) unsigned NOT NULL auto_increment,
  `doctype_id` int(11) default NULL,
  `doc_code` varchar(100) default NULL,
  `etl_code` varchar(100) default NULL,
  `doc_date` date default NULL,
  `doc_title` text,
  `doc_io_id` int(10) unsigned default NULL,
  `doc_file` text,
  `refer_type` int(11) default NULL,
  `refer_code` varchar(100) default NULL,
  `refer_date` date default NULL,
  `refer_file` text,
  `doc_from` text,
  `doc_to` text,
  `signer_id` int(10) unsigned default NULL,
  `doc_comment` text,
  `remark` text,
  `place_sent` text,
  `createby` int(10) unsigned default NULL,
  `back` varchar(10) default NULL,
  `back_date` date default NULL,
  `doc_status` int(11) default NULL,
  `m_date` date default NULL,
  `up_date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
  `m_step` enum('counter','counter_return','secretary','public') default NULL,
  `tm_signer` varchar(255) default NULL,
  `owner` int(11) default NULL,
  PRIMARY KEY  (`doc_id`),
  KEY `doc_io_id` (`doc_io_id`),
  KEY `signer_id` (`signer_id`),
  KEY `doctype_id` (`doctype_id`),
  KEY `createby` (`createby`),
  KEY `refer_type` (`refer_type`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `tbl_manage_doc`
--

DROP TABLE IF EXISTS `tbl_manage_doc`;
CREATE TABLE IF NOT EXISTS `tbl_manage_doc` (
  `m_id` bigint(20) unsigned NOT NULL auto_increment,
  `doc_id` bigint(20) unsigned default NULL,
  `receive_person` int(10) unsigned default NULL,
  `orgunitid` int(11) default NULL,
  `position_id` int(10) unsigned default NULL,
  `m_date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
  `sysuserid` int(10) unsigned default NULL,
  `receive_status` tinyint(4) NOT NULL default '1' COMMENT '1=not_receive, 2=Already_receive_document',
  `type_doc_status` enum('doc_in','doc_out') default NULL,
  PRIMARY KEY  (`m_id`),
  KEY `receive_person` (`receive_person`),
  KEY `doc_id` (`doc_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `tbl_sysrole`
--

DROP TABLE IF EXISTS `tbl_sysrole`;
CREATE TABLE IF NOT EXISTS `tbl_sysrole` (
  `role_id` int(11) NOT NULL auto_increment,
  `role_name` text,
  PRIMARY KEY  (`role_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;

--
-- Dumping data for table `tbl_sysrole`
--

INSERT INTO `tbl_sysrole` (`role_id`, `role_name`) VALUES
(1, 'administrator'),
(2, 'normal');

-- --------------------------------------------------------

--
-- Stand-in structure for view `v_user`
--
DROP VIEW IF EXISTS `v_user`;
CREATE TABLE IF NOT EXISTS `v_user` (
`sysuserid` int(10) unsigned
,`emp_code` int(10) unsigned
,`first_name` varchar(255)
,`last_name` varchar(255)
,`username` varchar(100)
,`email_address` varchar(255)
,`password` varchar(100)
,`role_id` int(11)
,`role_name` text
,`orgunitid` decimal(11,0)
,`orgunitid_r` int(10) unsigned
,`orgunitname` varchar(255)
,`parentunit` int(11)
,`position_id` int(10) unsigned
,`position_name` varchar(255)
,`isdeleted` int(11)
,`isinactive` int(11)
,`sys_type` enum('none','counter','secretary')
);
-- --------------------------------------------------------

--
-- Structure for view `v_user`
--
DROP TABLE IF EXISTS `v_user`;

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v_user` AS select `u`.`sysuserid` AS `sysuserid`,`u`.`emp_code` AS `emp_code`,`u`.`first_name` AS `first_name`,`u`.`last_name` AS `last_name`,`u`.`username` AS `username`,`u`.`email_address` AS `email_address`,`u`.`password` AS `password`,`u`.`role_id` AS `role_id`,`r`.`role_name` AS `role_name`,if((`org`.`parentunit` <> 0),`org`.`parentunit`,`org`.`orgunitid`) AS `orgunitid`,`org`.`orgunitid` AS `orgunitid_r`,if((`org`.`parentunit` <> 0),(select `o`.`orgunitname` AS `orgunitname` from `orgunit` `o` where (`o`.`orgunitid` = `org`.`parentunit`)),`org`.`orgunitname`) AS `orgunitname`,`org`.`parentunit` AS `parentunit`,`ptn`.`position_id` AS `position_id`,`ptn`.`position_name` AS `position_name`,`u`.`isdeleted` AS `isdeleted`,`u`.`isinactive` AS `isinactive`,`u`.`sys_type` AS `sys_type` from (((`sys_user` `u` join `tbl_sysrole` `r` on((`r`.`role_id` = `u`.`role_id`))) left join `orgunit` `org` on((`org`.`orgunitid` = `u`.`orgunitid`))) left join `emp_position` `ptn` on((`ptn`.`position_id` = `u`.`position_id`)));

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
