-- Table structure for table `item_barcode`
--

CREATE TABLE IF NOT EXISTS `item_barcode` (
  `id` int(10) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `uom_id` int(10) unsigned NOT NULL,
  `barcode` varchar(255) NOT NULL DEFAULT '',
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `item_bom`
--

CREATE TABLE IF NOT EXISTS `item_bom` (
  `id` int(10) unsigned NOT NULL,
  `code` varchar(10) NOT NULL,
  `description` varchar(60) NOT NULL DEFAULT '',
  `parent_item_id` int(10) unsigned NOT NULL,
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `item_bom_list`
--

CREATE TABLE IF NOT EXISTS `item_bom_list` (
  `id` int(10) unsigned NOT NULL,
  `parent_bom_id` int(10) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `bom_type` char(1) NOT NULL,
  `usage_qty` decimal(11,4) DEFAULT '0.0000',
  `uom_id` int(10) unsigned NOT NULL,
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `item_cost`
--

CREATE TABLE IF NOT EXISTS `item_cost` (
  `id` int(10) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `division_id` int(10) unsigned NOT NULL,
  `vendor_id` int(10) unsigned DEFAULT '0',
  `uom_id` int(10) unsigned NOT NULL,
  `currency_id` int(10) unsigned NOT NULL,
  `unit_price` decimal(11,4) unsigned NOT NULL DEFAULT '0.0000',
  `valid_from` datetime NOT NULL,
  `valid_to` datetime NOT NULL,
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `item_cost_ref`
--

CREATE TABLE IF NOT EXISTS `item_cost_ref` (
  `id` int(10) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `company_id` int(10) unsigned NOT NULL,
  `period_from` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `period_to` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `avg_cost` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `latest_cost` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `cost_01` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `cost_02` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `cost_03` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `cost_04` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `qty_01` decimal(14,4) NOT NULL DEFAULT '0.0000',
  `qty_02` decimal(14,4) NOT NULL DEFAULT '0.0000',
  `qty_03` decimal(14,4) NOT NULL DEFAULT '0.0000',
  `qty_04` decimal(14,4) NOT NULL DEFAULT '0.0000',
  `amt_01` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `amt_02` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `amt_03` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `amt_04` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `remark_1` varchar(255) NOT NULL DEFAULT '',
  `remark_2` varchar(255) NOT NULL DEFAULT '',
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `userdate_01` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_02` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_03` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_04` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `item_division`
--

CREATE TABLE IF NOT EXISTS `item_division` (
  `id` int(10) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `division_id` int(10) unsigned NOT NULL,
  `gl_account_sales` varchar(20) NOT NULL DEFAULT '',
  `gl_account_salesreturn` varchar(20) NOT NULL DEFAULT '',
  `gl_account_cashsales` varchar(20) NOT NULL DEFAULT '',
  `gl_account_purchase` varchar(20) NOT NULL DEFAULT '',
  `gl_account_cashpurchase` varchar(20) NOT NULL DEFAULT '',
  `gl_account_purchasereturn` varchar(20) NOT NULL DEFAULT '',
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `item_field`
--

CREATE TABLE IF NOT EXISTS `item_field` (
  `id` int(10) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `usertext_01` longtext,
  `usertext_02` longtext,
  `usertext_03` longtext,
  `usertext_04` longtext,
  `usertext_05` longtext,
  `userfield_01` varchar(255) DEFAULT '',
  `userfield_02` varchar(255) DEFAULT '',
  `userfield_03` varchar(255) DEFAULT '',
  `userfield_04` varchar(255) DEFAULT '',
  `userfield_05` varchar(255) DEFAULT '',
  `usernumber_01` decimal(11,4) DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) DEFAULT '0.0000',
  `usernumber_05` decimal(11,4) DEFAULT '0.0000',
  `useryesno_01` tinyint(1) DEFAULT '0',
  `useryesno_02` tinyint(1) DEFAULT '0',
  `useryesno_03` tinyint(1) DEFAULT '0',
  `useryesno_04` tinyint(1) DEFAULT '0',
  `useryesno_05` tinyint(1) DEFAULT '0',
  `userdate_01` datetime DEFAULT '1970-01-01 00:00:00',
  `userdate_02` datetime DEFAULT '1970-01-01 00:00:00',
  `userdate_03` datetime DEFAULT '1970-01-01 00:00:00',
  `userdate_04` datetime DEFAULT '1970-01-01 00:00:00',
  `userdate_05` datetime DEFAULT '1970-01-01 00:00:00',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `item_group`
--

CREATE TABLE IF NOT EXISTS `item_group` (
  `id` int(10) unsigned NOT NULL,
  `code` varchar(10) NOT NULL,
  `description` varchar(60) NOT NULL DEFAULT '',
  `sales_tax_id` int(10) unsigned NOT NULL DEFAULT '0',
  `purchase_tax_id` int(10) unsigned NOT NULL DEFAULT '0',
  `gl_account_sales` varchar(20) NOT NULL DEFAULT '',
  `gl_account_salesreturn` varchar(20) NOT NULL DEFAULT '',
  `gl_account_cashsales` varchar(20) NOT NULL DEFAULT '',
  `gl_account_purchase` varchar(20) NOT NULL DEFAULT '',
  `gl_account_cashpurchase` varchar(20) NOT NULL DEFAULT '',
  `gl_account_purchasereturn` varchar(20) NOT NULL DEFAULT '',
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `item_group`
--

INSERT INTO `item_group` (`id`, `code`, `description`, `sales_tax_id`, `purchase_tax_id`, `gl_account_sales`, `gl_account_salesreturn`, `gl_account_cashsales`, `gl_account_purchase`, `gl_account_cashpurchase`, `gl_account_purchasereturn`, `userfield_01`, `userfield_02`, `usernumber_01`, `usernumber_02`, `useryesno_01`, `useryesno_02`, `created`, `createdby`, `updated`, `updatedby`) VALUES
(1, '-', '-', 0, 0, '', '', '', '', '', '', '', '', '0.0000', '0.0000', 0, 0, '2012-02-29 22:32:25', 1, '2012-02-29 22:32:25', 1);

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

--
-- Table structure for table `item_group_1`
--

CREATE TABLE IF NOT EXISTS `item_group_1` (
  `id` int(10) unsigned NOT NULL,
  `code` varchar(10) NOT NULL,
  `description` varchar(60) NOT NULL DEFAULT '',
  `sales_tax_id` int(10) unsigned NOT NULL DEFAULT '0',
  `purchase_tax_id` int(10) unsigned NOT NULL DEFAULT '0',
  `gl_account_sales` varchar(20) NOT NULL DEFAULT '',
  `gl_account_salesreturn` varchar(20) NOT NULL DEFAULT '',
  `gl_account_cashsales` varchar(20) NOT NULL DEFAULT '',
  `gl_account_purchase` varchar(20) NOT NULL DEFAULT '',
  `gl_account_cashpurchase` varchar(20) NOT NULL DEFAULT '',
  `gl_account_purchasereturn` varchar(20) NOT NULL DEFAULT '',
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `item_group_1`
--

INSERT INTO `item_group_1` (`id`, `code`, `description`, `sales_tax_id`, `purchase_tax_id`, `gl_account_sales`, `gl_account_salesreturn`, `gl_account_cashsales`, `gl_account_purchase`, `gl_account_cashpurchase`, `gl_account_purchasereturn`, `userfield_01`, `userfield_02`, `usernumber_01`, `usernumber_02`, `useryesno_01`, `useryesno_02`, `created`, `createdby`, `updated`, `updatedby`) VALUES
(1, '-', '-', 0, 0, '', '', '', '', '', '', '', '', '0.0000', '0.0000', 0, 0, '2012-02-29 22:32:25', 1, '2012-02-29 22:32:25', 1);

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

--
-- Table structure for table `item_group_2`
--

CREATE TABLE IF NOT EXISTS `item_group_2` (
  `id` int(10) unsigned NOT NULL,
  `code` varchar(10) NOT NULL,
  `description` varchar(60) NOT NULL DEFAULT '',
  `sales_tax_id` int(10) unsigned NOT NULL DEFAULT '0',
  `purchase_tax_id` int(10) unsigned NOT NULL DEFAULT '0',
  `gl_account_sales` varchar(20) NOT NULL DEFAULT '',
  `gl_account_salesreturn` varchar(20) NOT NULL DEFAULT '',
  `gl_account_cashsales` varchar(20) NOT NULL DEFAULT '',
  `gl_account_purchase` varchar(20) NOT NULL DEFAULT '',
  `gl_account_cashpurchase` varchar(20) NOT NULL DEFAULT '',
  `gl_account_purchasereturn` varchar(20) NOT NULL DEFAULT '',
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `item_group_2`
--

INSERT INTO `item_group_2` (`id`, `code`, `description`, `sales_tax_id`, `purchase_tax_id`, `gl_account_sales`, `gl_account_salesreturn`, `gl_account_cashsales`, `gl_account_purchase`, `gl_account_cashpurchase`, `gl_account_purchasereturn`, `userfield_01`, `userfield_02`, `usernumber_01`, `usernumber_02`, `useryesno_01`, `useryesno_02`, `created`, `createdby`, `updated`, `updatedby`) VALUES
(1, '-', '-', 0, 0, '', '', '', '', '', '', '', '', '0.0000', '0.0000', 0, 0, '2012-02-29 22:32:25', 1, '2012-02-29 22:32:25', 1);

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

--
-- Table structure for table `item_image`
--

CREATE TABLE IF NOT EXISTS `item_image` (
  `id` int(10) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `description` varchar(60) DEFAULT '',
  `description1` varchar(60) DEFAULT '',
  `description2` varchar(60) DEFAULT '',
  `picture` mediumblob,
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `item_price`
--

CREATE TABLE IF NOT EXISTS `item_price` (
  `id` int(10) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `price_group_id` int(10) unsigned NOT NULL DEFAULT '0',
  `uom_id` int(10) unsigned NOT NULL,
  `currency_id` int(10) unsigned NOT NULL,
  `unit_price` decimal(11,4) unsigned NOT NULL DEFAULT '0.0000',
  `valid_from` datetime NOT NULL,
  `valid_to` datetime NOT NULL,
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `item_price_cbp`
--

CREATE TABLE IF NOT EXISTS `item_price_cbp` (
  `id` int(10) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `price_group_id` int(10) unsigned NOT NULL DEFAULT '0',
  `uom_id` int(10) unsigned NOT NULL,
  `currency_id` int(10) unsigned NOT NULL,
  `unit_price` decimal(11,4) unsigned NOT NULL DEFAULT '0.0000',
  `valid_from` datetime NOT NULL,
  `valid_to` datetime NOT NULL,
  `user_field_01` varchar(255) DEFAULT '',
  `user_field_02` varchar(255) DEFAULT '',
  `user_field_03` varchar(255) DEFAULT '',
  `user_field_04` varchar(255) DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `item_price_level`
--

CREATE TABLE IF NOT EXISTS `item_price_level` (
  `id` int(10) unsigned NOT NULL,
  `item_price_id` int(10) NOT NULL,
  `price_group_id` int(10) unsigned NOT NULL DEFAULT '0',
  `division_id` int(10) unsigned NOT NULL DEFAULT '0',
  `customer_id` int(10) unsigned NOT NULL DEFAULT '0',
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `userpercent_01` decimal(5,2) DEFAULT '0.00',
  `userpercent_02` decimal(5,2) DEFAULT '0.00',
  `userpercent_03` decimal(5,2) DEFAULT '0.00',
  `userpercent_04` decimal(5,2) DEFAULT '0.00',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `item_scp_reorder`
--

CREATE TABLE IF NOT EXISTS `item_scp_reorder` (
  `id` int(10) unsigned NOT NULL,
  `division_id` int(10) unsigned NOT NULL DEFAULT '0',
  `customer_id` int(10) unsigned NOT NULL DEFAULT '0',
  `item_id` int(10) unsigned NOT NULL,
  `minimum_qty` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `customer_category_id` int(10) unsigned NOT NULL DEFAULT '0',
  `customer_category_01_id` int(10) unsigned NOT NULL DEFAULT '0',
  `customer_category_02_id` int(10) unsigned NOT NULL DEFAULT '0',
  `item_group_id` int(10) unsigned NOT NULL DEFAULT '0',
  `item_group_01_id` int(10) unsigned NOT NULL DEFAULT '0',
  `item_group_02_id` int(10) unsigned NOT NULL DEFAULT '0',
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `userfield_05` varchar(255) NOT NULL DEFAULT '',
  `userfield_06` varchar(255) NOT NULL DEFAULT '',
  `userfield_07` varchar(255) NOT NULL DEFAULT '',
  `userfield_08` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_05` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_06` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_07` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_08` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_05` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_06` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_07` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_08` tinyint(1) NOT NULL DEFAULT '0',
  `userdate_01` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_02` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_03` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_04` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_05` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_06` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_07` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_08` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `item_uom`
--

CREATE TABLE IF NOT EXISTS `item_uom` (
  `id` int(10) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `uom_id` int(10) unsigned NOT NULL,
  `uom_rate` decimal(11,4) unsigned NOT NULL DEFAULT '1.0000',
  `uptodate_cost` decimal(11,4) DEFAULT '0.0000',
  `average_cost` decimal(11,4) DEFAULT '0.0000',
  `normal_level` decimal(11,4) DEFAULT '0.0000',
  `reorder_level` decimal(11,4) DEFAULT '0.0000',
  `reorder_qty` decimal(11,4) DEFAULT '0.0000',
  `min_order_qty` decimal(11,4) DEFAULT '0.0000',
  `gl_account_sales` varchar(20) NOT NULL DEFAULT '',
  `gl_account_salesreturn` varchar(20) NOT NULL DEFAULT '',
  `gl_account_cashsales` varchar(20) NOT NULL DEFAULT '',
  `gl_account_purchase` varchar(20) NOT NULL DEFAULT '',
  `gl_account_cashpurchase` varchar(20) NOT NULL DEFAULT '',
  `gl_account_purchasereturn` varchar(20) NOT NULL DEFAULT '',
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `userdate_01` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_02` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_03` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_04` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Stand-in structure for view `item_uom_stat`
--
CREATE TABLE IF NOT EXISTS `item_uom_stat` (
`item_id` int(10) unsigned
,`max_rate` decimal(11,4) unsigned
,`min_rate` decimal(11,4) unsigned
);

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

--
-- Table structure for table `location`
--

CREATE TABLE IF NOT EXISTS `location` (
  `id` int(10) unsigned NOT NULL,
  `code` varchar(15) NOT NULL,
  `description` varchar(60) NOT NULL DEFAULT '',
  `is_stock_location` tinyint(1) NOT NULL DEFAULT '1',
  `is_transitory` tinyint(1) NOT NULL DEFAULT '0',
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `location`
--

INSERT INTO `location` (`id`, `code`, `description`, `is_stock_location`, `is_transitory`, `is_active`, `created`, `createdby`, `updated`, `updatedby`) VALUES
(1, 'GOOD', 'GOOD', 1, 0, 1, '2012-02-19 19:27:08', 1, '2019-12-25 13:27:50', 1),
(2, 'BAD', 'BAD', 0, 0, 1, '2019-12-25 13:28:03', 1, '2019-12-25 13:28:03', 1);

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

--
-- Table structure for table `location_check_in`
--

CREATE TABLE IF NOT EXISTS `location_check_in` (
  `id` int(10) unsigned NOT NULL,
  `checkin_date` datetime NOT NULL,
  `division_id` int(10) unsigned NOT NULL,
  `customer_id` int(10) unsigned NOT NULL,
  `branch_id` int(10) unsigned NOT NULL DEFAULT '0',
  `branch_code` varchar(20) DEFAULT '',
  `area_id` int(10) unsigned NOT NULL,
  `area_code` varchar(20) DEFAULT '',
  `salesman_id` int(10) unsigned NOT NULL,
  `lat` float(10,6) NOT NULL,
  `lng` float(10,6) NOT NULL,
  `checkout_date` datetime NOT NULL,
  `checkout_lat` float(10,6) NOT NULL,
  `checkout_lng` float(10,6) NOT NULL,
  `checkout_photo` mediumblob,
  `checkin_photo` mediumblob,
  `reason` varchar(200) DEFAULT '',
  `reason_id` int(10) DEFAULT '0',
  `description` varchar(200) NOT NULL DEFAULT '',
  `ref_no_01` varchar(30) NOT NULL DEFAULT '',
  `ref_no_02` varchar(30) NOT NULL DEFAULT '',
  `remark` varchar(200) NOT NULL DEFAULT '',
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `mobile_bulletin`
--

CREATE TABLE IF NOT EXISTS `mobile_bulletin` (
  `id` int(10) unsigned NOT NULL,
  `division_id` int(10) unsigned NOT NULL,
  `salesman_id` int(10) unsigned NOT NULL DEFAULT '0',
  `salesteam_id` int(10) unsigned NOT NULL DEFAULT '0',
  `subject` varchar(255) NOT NULL DEFAULT '',
  `status` tinyint(1) NOT NULL DEFAULT '1',
  `urgent` tinyint(1) NOT NULL DEFAULT '0',
  `valid_from` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `valid_to` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `note_01` text,
  `note_02` text,
  `note_03` text,
  `note_04` text,
  `photo_01` mediumblob,
  `photo_02` mediumblob,
  `photo_03` mediumblob,
  `photo_04` mediumblob,
  `photo_05` mediumblob,
  `remark_01` varchar(255) NOT NULL DEFAULT '',
  `remark_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_01` varchar(255) DEFAULT '',
  `userfield_02` varchar(255) DEFAULT '',
  `userfield_03` varchar(255) DEFAULT '',
  `userfield_04` varchar(255) DEFAULT '',
  `usernumber_01` decimal(11,4) DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) DEFAULT '0.0000',
  `useryesno_01` tinyint(1) DEFAULT '0',
  `useryesno_02` tinyint(1) DEFAULT '0',
  `useryesno_03` tinyint(1) DEFAULT '0',
  `useryesno_04` tinyint(1) DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `mobile_download`
--

CREATE TABLE IF NOT EXISTS `mobile_download` (
  `id` int(10) unsigned NOT NULL,
  `mobile_profile_id` int(10) unsigned NOT NULL,
  `table_name` varchar(40) NOT NULL,
  `record_id` int(10) unsigned NOT NULL,
  `action` int(1) unsigned NOT NULL,
  `json_command` longtext NOT NULL,
  `created` datetime NOT NULL,
  `flag` varchar(255) NOT NULL DEFAULT '',
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `userdate_01` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_02` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_03` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_04` datetime NOT NULL DEFAULT '1970-01-01 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `mobile_history`
--

CREATE TABLE IF NOT EXISTS `mobile_history` (
  `id` int(10) unsigned NOT NULL,
  `mobile_profile_id` int(10) unsigned NOT NULL,
  `table_name` varchar(40) NOT NULL,
  `record_id` int(10) unsigned NOT NULL,
  `created` datetime NOT NULL,
  `last_sync_time` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `mobile_profile`
--

CREATE TABLE IF NOT EXISTS `mobile_profile` (
  `id` int(10) unsigned NOT NULL,
  `user_id` int(10) unsigned NOT NULL,
  `username` varchar(30) NOT NULL,
  `device_uuid` varchar(40) NOT NULL,
  `android_version` varchar(50) NOT NULL DEFAULT '',
  `version_code` varchar(50) NOT NULL DEFAULT '',
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `userdate_01` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_02` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_03` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_04` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `mobile_progress`
--

CREATE TABLE IF NOT EXISTS `mobile_progress` (
  `mobile_profile_id` int(10) NOT NULL DEFAULT '0',
  `status` varchar(30) NOT NULL DEFAULT '',
  `progress_max` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `mobile_sync`
--

CREATE TABLE IF NOT EXISTS `mobile_sync` (
  `id` int(10) unsigned NOT NULL,
  `doc_type` char(3) NOT NULL,
  `doc_id` int(10) unsigned NOT NULL,
  `mobile_record_id` int(10) unsigned NOT NULL,
  `mobile_profile_id` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `packing`
--

CREATE TABLE IF NOT EXISTS `packing` (
  `id` int(10) unsigned NOT NULL,
  `do_inv_hdr_id` int(10) unsigned NOT NULL,
  `do_inv_dtl_id` int(10) unsigned NOT NULL,
  `line_no` int(4) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `location_id` int(10) unsigned NOT NULL,
  `shelf_id` int(10) unsigned NOT NULL DEFAULT '1',
  `batch_no` varchar(30) NOT NULL DEFAULT '',
  `serial_no` varchar(30) NOT NULL DEFAULT '',
  `stock_rotation_id` int(10) unsigned NOT NULL DEFAULT '1',
  `expiry_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `packed_qty` decimal(14,4) unsigned NOT NULL DEFAULT '0.0000',
  `packed_uom_id` int(10) unsigned NOT NULL,
  `packed_uom_code` varchar(10) NOT NULL DEFAULT '',
  `packed_uom_rate` decimal(14,4) unsigned NOT NULL DEFAULT '0.0000',
  `shipment_code` varchar(30) NOT NULL DEFAULT '',
  `shipment_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `transport_code` varchar(30) NOT NULL DEFAULT '',
  `driver_name` varchar(30) NOT NULL DEFAULT '',
  `shipment_remark` varchar(255) DEFAULT '',
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `userdate_01` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_02` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_03` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_04` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `payment_method`
--

CREATE TABLE IF NOT EXISTS `payment_method` (
  `id` int(10) unsigned NOT NULL,
  `company_id` int(10) unsigned NOT NULL,
  `code` varchar(20) DEFAULT '',
  `description` varchar(60) NOT NULL DEFAULT '',
  `gl_account_bank` varchar(20) NOT NULL DEFAULT '',
  `gl_account_bankcharge` varchar(20) NOT NULL DEFAULT '',
  `gl_account_cccharge` varchar(20) DEFAULT '',
  `user_field_01` varchar(20) DEFAULT '',
  `user_field_02` varchar(20) DEFAULT '',
  `user_field_03` varchar(20) DEFAULT '',
  `user_field_04` varchar(20) DEFAULT '',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `payment_method`
--

INSERT INTO `payment_method` (`id`, `company_id`, `code`, `description`, `gl_account_bank`, `gl_account_bankcharge`, `gl_account_cccharge`, `user_field_01`, `user_field_02`, `user_field_03`, `user_field_04`, `created`, `createdby`, `updated`, `updatedby`) VALUES
(1, 1, 'Default', 'Default', '', '', '', '', '', '', '', '2011-10-31 23:49:59', 1, '2011-10-31 23:49:59', 1);

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

--
-- Table structure for table `picking`
--

CREATE TABLE IF NOT EXISTS `picking` (
  `id` int(10) unsigned NOT NULL,
  `picking_code` varchar(30) NOT NULL DEFAULT '',
  `mode` int(11) NOT NULL DEFAULT '0',
  `item_id` int(10) unsigned NOT NULL,
  `location_id` int(10) unsigned NOT NULL,
  `shelf_id` int(10) unsigned NOT NULL DEFAULT '1',
  `batch_no` varchar(30) NOT NULL DEFAULT '',
  `serial_no` varchar(30) NOT NULL DEFAULT '',
  `stock_rotation_id` int(10) unsigned NOT NULL DEFAULT '1',
  `expiry_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `uom_id_01` int(10) unsigned NOT NULL DEFAULT '0',
  `uom_id_02` int(10) unsigned NOT NULL DEFAULT '0',
  `uom_id_03` int(10) unsigned NOT NULL DEFAULT '0',
  `uom_id_04` int(10) unsigned NOT NULL DEFAULT '0',
  `uom_id_05` int(10) unsigned NOT NULL DEFAULT '0',
  `uom_rate_01` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `uom_rate_02` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `uom_rate_03` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `uom_rate_04` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `uom_rate_05` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `qty_01` decimal(14,4) unsigned NOT NULL DEFAULT '0.0000',
  `qty_02` decimal(14,4) unsigned NOT NULL DEFAULT '0.0000',
  `qty_03` decimal(14,4) unsigned NOT NULL DEFAULT '0.0000',
  `qty_04` decimal(14,4) unsigned NOT NULL DEFAULT '0.0000',
  `qty_05` decimal(14,4) unsigned NOT NULL DEFAULT '0.0000',
  `picked_case_qty` decimal(14,4) unsigned NOT NULL DEFAULT '0.0000',
  `case_uom` varchar(10) NOT NULL DEFAULT '',
  `case_uom_id` int(10) unsigned NOT NULL DEFAULT '0',
  `picked_loose_qty` decimal(14,4) unsigned NOT NULL DEFAULT '0.0000',
  `loose_uom` varchar(10) NOT NULL DEFAULT '',
  `loose_uom_id` int(10) unsigned NOT NULL DEFAULT '0',
  `picked_total_qty` decimal(14,4) unsigned NOT NULL DEFAULT '0.0000',
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `userdate_01` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_02` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_03` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_04` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `picking_reporting`
--

CREATE TABLE IF NOT EXISTS `picking_reporting` (
  `id` int(10) unsigned NOT NULL,
  `date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `user_id` int(11) NOT NULL DEFAULT '0',
  `location_id` int(10) unsigned NOT NULL,
  `mode` int(11) NOT NULL DEFAULT '0',
  `picking_code` varchar(30) NOT NULL DEFAULT '',
  `item_id` int(10) unsigned NOT NULL,
  `batch_no` varchar(30) NOT NULL DEFAULT '',
  `serial_no` varchar(30) NOT NULL DEFAULT '',
  `expiry_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `uom` varchar(10) NOT NULL DEFAULT '',
  `uom_rate` decimal(11,4) NOT NULL,
  `uom_qty` decimal(14,4) unsigned NOT NULL DEFAULT '0.0000',
  `qty` decimal(14,4) unsigned NOT NULL DEFAULT '0.0000',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `prch_odr_dtl`
--

CREATE TABLE IF NOT EXISTS `prch_odr_dtl` (
  `id` int(10) unsigned NOT NULL,
  `hdr_id` int(10) unsigned NOT NULL,
  `line_no` int(4) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `location_id` int(10) unsigned NOT NULL,
  `uom_id` int(10) unsigned NOT NULL,
  `uom_rate` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `price` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `list_price` decimal(14,6) DEFAULT '0.000000',
  `description` varchar(200) DEFAULT NULL,
  `shelf_id` int(10) unsigned NOT NULL DEFAULT '1',
  `batch_no` varchar(30) NOT NULL DEFAULT '',
  `serial_no` varchar(30) NOT NULL DEFAULT '',
  `stock_rotation_id` int(10) unsigned NOT NULL DEFAULT '1',
  `expiry_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `del_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `qty` decimal(14,4) unsigned NOT NULL DEFAULT '0.0000',
  `recv_qty` decimal(14,4) unsigned NOT NULL DEFAULT '0.0000',
  `disc_percent_01` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_02` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_03` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_04` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_05` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_06` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_07` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_08` decimal(7,4) DEFAULT '0.0000',
  `disc_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `disc_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `tax_group_id` int(10) unsigned DEFAULT '0',
  `tax_id_01` int(10) unsigned DEFAULT '0',
  `tax_percent_01` decimal(5,2) DEFAULT '0.00',
  `tax_id_02` int(10) unsigned DEFAULT '0',
  `tax_percent_02` decimal(5,2) DEFAULT '0.00',
  `tax_id_03` int(10) unsigned DEFAULT '0',
  `tax_percent_03` decimal(5,2) DEFAULT '0.00',
  `tax_id_04` int(10) unsigned DEFAULT '0',
  `tax_percent_04` decimal(5,2) DEFAULT '0.00',
  `tax_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `tax_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `order_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `order_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `remark` varchar(200) NOT NULL DEFAULT '',
  `is_closed` tinyint(1) NOT NULL DEFAULT '0',
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `userdate_01` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_02` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_03` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_04` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `prch_odr_hdr`
--

CREATE TABLE IF NOT EXISTS `prch_odr_hdr` (
  `id` int(10) unsigned NOT NULL,
  `doc_code` varchar(30) NOT NULL,
  `ref_code` varchar(30) NOT NULL DEFAULT '',
  `doc_date` datetime NOT NULL,
  `due_date` datetime NOT NULL,
  `order_type` char(1) NOT NULL,
  `company_id` int(10) unsigned NOT NULL,
  `vendor_id` int(10) unsigned NOT NULL,
  `purchaser_id` int(10) unsigned NOT NULL,
  `project_id` int(10) unsigned NOT NULL DEFAULT '1',
  `division_id` int(10) unsigned NOT NULL,
  `term_id` int(10) unsigned NOT NULL,
  `term_code` varchar(20) NOT NULL,
  `term_day` int(5) NOT NULL,
  `branch_id` int(10) unsigned NOT NULL DEFAULT '0',
  `branch_code` varchar(20) DEFAULT '',
  `area_id` int(10) unsigned NOT NULL,
  `area_code` varchar(20) DEFAULT '',
  `address_01` varchar(100) NOT NULL DEFAULT '',
  `address_02` varchar(100) NOT NULL DEFAULT '',
  `address_03` varchar(100) NOT NULL DEFAULT '',
  `address_04` varchar(100) NOT NULL DEFAULT '',
  `attention` varchar(80) NOT NULL DEFAULT '',
  `postcode` varchar(10) NOT NULL DEFAULT '',
  `phone_01` varchar(30) NOT NULL DEFAULT '',
  `phone_02` varchar(30) NOT NULL DEFAULT '',
  `fax_01` varchar(30) NOT NULL DEFAULT '',
  `fax_02` varchar(30) NOT NULL DEFAULT '',
  `description` varchar(200) NOT NULL DEFAULT '',
  `currency_rate` decimal(14,6) NOT NULL DEFAULT '1.000000',
  `currency_id` int(10) unsigned NOT NULL,
  `disc_percent_01` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_02` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_03` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_04` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_05` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_06` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_07` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_08` decimal(7,4) DEFAULT '0.0000',
  `disc_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `disc_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `tax_group_id` int(10) unsigned DEFAULT '0',
  `tax_id_01` int(10) unsigned DEFAULT '0',
  `tax_percent_01` decimal(5,2) DEFAULT '0.00',
  `tax_id_02` int(10) unsigned DEFAULT '0',
  `tax_percent_02` decimal(5,2) DEFAULT '0.00',
  `tax_id_03` int(10) unsigned DEFAULT '0',
  `tax_percent_03` decimal(5,2) DEFAULT '0.00',
  `tax_id_04` int(10) unsigned DEFAULT '0',
  `tax_percent_04` decimal(5,2) DEFAULT '0.00',
  `tax_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `tax_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `order_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `order_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `remark_01` varchar(200) NOT NULL DEFAULT '',
  `remark_02` varchar(200) NOT NULL DEFAULT '',
  `is_printed` tinyint(1) NOT NULL DEFAULT '0',
  `status` int(2) NOT NULL DEFAULT '0',
  `revision` varchar(8) NOT NULL DEFAULT '1.0.0',
  `voided` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `voidedby` int(10) DEFAULT '0',
  `void_reason_id` int(10) DEFAULT '0',
  `void_remark` text,
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `userdate_01` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_02` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_03` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_04` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `prch_req_dtl`
--

CREATE TABLE IF NOT EXISTS `prch_req_dtl` (
  `id` int(10) unsigned NOT NULL,
  `hdr_id` int(10) unsigned NOT NULL,
  `line_no` int(4) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `location_id` int(10) unsigned NOT NULL,
  `uom_id` int(10) unsigned NOT NULL,
  `uom_rate` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `price` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `list_price` decimal(14,6) DEFAULT '0.000000',
  `description` varchar(200) NOT NULL DEFAULT '',
  `del_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `qty` decimal(14,4) unsigned NOT NULL DEFAULT '0.0000',
  `disc_percent_01` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_02` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_03` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_04` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_05` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_06` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_07` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_08` decimal(7,4) DEFAULT '0.0000',
  `disc_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `disc_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `tax_group_id` int(10) unsigned DEFAULT '0',
  `tax_id_01` int(10) unsigned DEFAULT '0',
  `tax_percent_01` decimal(5,2) DEFAULT '0.00',
  `tax_id_02` int(10) unsigned DEFAULT '0',
  `tax_percent_02` decimal(5,2) DEFAULT '0.00',
  `tax_id_03` int(10) unsigned DEFAULT '0',
  `tax_percent_03` decimal(5,2) DEFAULT '0.00',
  `tax_id_04` int(10) unsigned DEFAULT '0',
  `tax_percent_04` decimal(5,2) DEFAULT '0.00',
  `tax_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `tax_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `order_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `order_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `remark` varchar(200) NOT NULL DEFAULT '',
  `is_closed` tinyint(1) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `prch_req_hdr`
--

CREATE TABLE IF NOT EXISTS `prch_req_hdr` (
  `id` int(10) unsigned NOT NULL,
  `doc_code` varchar(30) NOT NULL,
  `ref_code` varchar(30) NOT NULL DEFAULT '',
  `doc_date` datetime NOT NULL,
  `company_id` int(10) unsigned NOT NULL,
  `vendor_id` int(10) unsigned NOT NULL,
  `purchaser_id` int(10) unsigned NOT NULL,
  `project_id` int(10) unsigned NOT NULL DEFAULT '1',
  `division_id` int(10) unsigned NOT NULL,
  `term_id` int(10) unsigned NOT NULL,
  `term_code` varchar(20) NOT NULL,
  `term_day` int(5) NOT NULL,
  `description` varchar(200) NOT NULL DEFAULT '',
  `currency_rate` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `currency_id` int(10) unsigned NOT NULL,
  `disc_percent_01` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_02` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_03` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_04` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_05` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_06` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_07` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_08` decimal(7,4) DEFAULT '0.0000',
  `disc_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `disc_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `tax_id_01` int(10) unsigned DEFAULT '0',
  `tax_percent_01` decimal(5,2) DEFAULT '0.00',
  `tax_id_02` int(10) unsigned DEFAULT '0',
  `tax_percent_02` decimal(5,2) DEFAULT '0.00',
  `tax_id_03` int(10) unsigned DEFAULT '0',
  `tax_percent_03` decimal(5,2) DEFAULT '0.00',
  `tax_id_04` int(10) unsigned DEFAULT '0',
  `tax_percent_04` decimal(5,2) DEFAULT '0.00',
  `tax_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `tax_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `order_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `order_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `remark_01` varchar(200) NOT NULL DEFAULT '',
  `remark_02` varchar(200) NOT NULL DEFAULT '',
  `is_printed` tinyint(1) NOT NULL DEFAULT '0',
  `status` int(2) NOT NULL DEFAULT '0',
  `revision` varchar(8) NOT NULL DEFAULT '1.0.0',
  `voided` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `voidedby` int(10) DEFAULT '0',
  `void_reason_id` int(10) DEFAULT '0',
  `void_remark` text,
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `prch_return_tracking`
--

CREATE TABLE IF NOT EXISTS `prch_return_tracking` (
  `id` int(10) unsigned NOT NULL,
  `vendor_id` int(10) unsigned NOT NULL,
  `purchaser_id` int(10) unsigned DEFAULT NULL,
  `prch_ret_hdr_id` int(10) unsigned DEFAULT NULL,
  `prch_ret_hdr_date` datetime DEFAULT NULL,
  `prch_ret_dtl_id` int(10) unsigned DEFAULT NULL,
  `prch_ret_dtl_date` datetime DEFAULT NULL,
  `rd_dn_hdr_id` int(10) unsigned DEFAULT NULL,
  `rd_dn_hdr_date` datetime DEFAULT NULL,
  `rd_dn_dtl_id` int(10) unsigned DEFAULT NULL,
  `rd_dn_dtl_date` datetime DEFAULT NULL,
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `prch_ret_dtl`
--

CREATE TABLE IF NOT EXISTS `prch_ret_dtl` (
  `id` int(10) unsigned NOT NULL,
  `hdr_id` int(10) unsigned NOT NULL,
  `line_no` int(4) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `location_id` int(10) unsigned NOT NULL,
  `uom_id` int(10) unsigned NOT NULL,
  `uom_rate` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `price` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `list_price` decimal(14,6) DEFAULT '0.000000',
  `description` varchar(200) NOT NULL DEFAULT '',
  `shelf_id` int(10) unsigned NOT NULL DEFAULT '1',
  `batch_no` varchar(30) NOT NULL DEFAULT '',
  `serial_no` varchar(30) NOT NULL DEFAULT '',
  `stock_rotation_id` int(10) unsigned NOT NULL DEFAULT '1',
  `expiry_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `del_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `qty` decimal(14,4) NOT NULL DEFAULT '0.0000',
  `sent_qty` decimal(14,4) unsigned NOT NULL DEFAULT '0.0000',
  `disc_percent_01` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_02` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_03` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_04` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_05` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_06` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_07` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_08` decimal(7,4) DEFAULT '0.0000',
  `disc_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `disc_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `tax_group_id` int(10) unsigned NOT NULL,
  `tax_id_01` int(10) unsigned DEFAULT '0',
  `tax_percent_01` decimal(5,2) DEFAULT '0.00',
  `tax_id_02` int(10) unsigned DEFAULT '0',
  `tax_percent_02` decimal(5,2) DEFAULT '0.00',
  `tax_id_03` int(10) unsigned DEFAULT '0',
  `tax_percent_03` decimal(5,2) DEFAULT '0.00',
  `tax_id_04` int(10) unsigned DEFAULT '0',
  `tax_percent_04` decimal(5,2) DEFAULT '0.00',
  `tax_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `tax_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `order_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `order_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `remark` varchar(200) DEFAULT NULL,
  `is_closed` tinyint(1) NOT NULL DEFAULT '0',
  `reason_id` int(10) unsigned NOT NULL DEFAULT '0',
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `userdate_01` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_02` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_03` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_04` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `prch_ret_hdr`
--

CREATE TABLE IF NOT EXISTS `prch_ret_hdr` (
  `id` int(10) unsigned NOT NULL,
  `doc_code` varchar(30) NOT NULL,
  `ref_code` varchar(30) NOT NULL DEFAULT '',
  `doc_date` datetime NOT NULL,
  `order_type` char(1) NOT NULL,
  `company_id` int(10) unsigned NOT NULL,
  `vendor_id` int(10) unsigned NOT NULL,
  `purchaser_id` int(10) unsigned NOT NULL,
  `project_id` int(10) unsigned NOT NULL DEFAULT '1',
  `division_id` int(10) unsigned NOT NULL,
  `term_id` int(10) unsigned NOT NULL,
  `term_code` varchar(20) NOT NULL,
  `term_day` int(5) NOT NULL,
  `branch_id` int(10) unsigned NOT NULL DEFAULT '0',
  `branch_code` varchar(20) DEFAULT '',
  `area_id` int(10) unsigned NOT NULL,
  `area_code` varchar(20) DEFAULT '',
  `del_address_01` varchar(100) NOT NULL DEFAULT '',
  `del_address_02` varchar(100) NOT NULL DEFAULT '',
  `del_address_03` varchar(100) NOT NULL DEFAULT '',
  `del_address_04` varchar(100) NOT NULL DEFAULT '',
  `del_attention` varchar(80) NOT NULL DEFAULT '',
  `del_postcode` varchar(10) NOT NULL DEFAULT '',
  `del_phone_01` varchar(30) NOT NULL DEFAULT '',
  `del_phone_02` varchar(30) NOT NULL DEFAULT '',
  `del_fax_01` varchar(30) NOT NULL DEFAULT '',
  `del_fax_02` varchar(30) NOT NULL DEFAULT '',
  `description` varchar(200) NOT NULL DEFAULT '',
  `currency_rate` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `currency_id` int(10) unsigned NOT NULL,
  `disc_percent_01` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_02` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_03` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_04` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_05` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_06` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_07` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_08` decimal(7,4) DEFAULT '0.0000',
  `disc_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `disc_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `tax_group_id` int(10) unsigned DEFAULT '0',
  `tax_id_01` int(10) unsigned DEFAULT '0',
  `tax_percent_01` decimal(5,2) DEFAULT '0.00',
  `tax_id_02` int(10) unsigned DEFAULT '0',
  `tax_percent_02` decimal(5,2) DEFAULT '0.00',
  `tax_id_03` int(10) unsigned DEFAULT '0',
  `tax_percent_03` decimal(5,2) DEFAULT '0.00',
  `tax_id_04` int(10) unsigned DEFAULT '0',
  `tax_percent_04` decimal(5,2) DEFAULT '0.00',
  `tax_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `tax_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `order_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `order_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `status` int(2) NOT NULL DEFAULT '0',
  `remark_01` varchar(200) DEFAULT NULL,
  `remark_02` varchar(200) DEFAULT NULL,
  `voided` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `voidedby` int(10) DEFAULT '0',
  `void_reason_id` int(10) DEFAULT '0',
  `void_remark` text,
  `is_printed` tinyint(1) NOT NULL DEFAULT '0',
  `is_exported` tinyint(1) NOT NULL DEFAULT '0',
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `userdate_01` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_02` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_03` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_04` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `prch_tracking`
--

CREATE TABLE IF NOT EXISTS `prch_tracking` (
  `id` int(10) unsigned NOT NULL,
  `vendor_id` int(10) unsigned NOT NULL,
  `purchaser_id` int(10) unsigned DEFAULT NULL,
  `prch_odr_hdr_id` int(10) unsigned DEFAULT NULL,
  `prch_odr_hdr_date` datetime DEFAULT NULL,
  `prch_odr_dtl_id` int(10) unsigned DEFAULT NULL,
  `prch_odr_dtl_date` datetime DEFAULT NULL,
  `gr_pi_hdr_id` int(10) unsigned DEFAULT NULL,
  `gr_pi_hdr_date` datetime DEFAULT NULL,
  `gr_pi_dtl_id` int(10) unsigned DEFAULT NULL,
  `gr_pi_dtl_date` datetime DEFAULT NULL,
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `price_group`
--

CREATE TABLE IF NOT EXISTS `price_group` (
  `id` int(10) unsigned NOT NULL,
  `division_id` int(10) unsigned NOT NULL,
  `code` varchar(10) NOT NULL,
  `description` varchar(60) NOT NULL DEFAULT '',
  `remark` varchar(200) NOT NULL DEFAULT '',
  `disc_percent_01` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_02` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_03` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_04` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_05` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_06` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_07` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_08` decimal(7,4) DEFAULT '0.0000',
  `type` varchar(50) NOT NULL DEFAULT '',
  `max_amt` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `min_amt` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `valid_from` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `valid_to` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `userdate_01` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_02` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_03` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_04` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `price_group_customer_category`
--

CREATE TABLE IF NOT EXISTS `price_group_customer_category` (
  `id` int(10) unsigned NOT NULL,
  `price_group_id` int(10) unsigned NOT NULL,
  `customer_category_id` int(10) unsigned NOT NULL,
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `userdate_01` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_02` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_03` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_04` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `price_group_customer_category_1`
--

CREATE TABLE IF NOT EXISTS `price_group_customer_category_1` (
  `id` int(10) unsigned NOT NULL,
  `price_group_id` int(10) unsigned NOT NULL,
  `customer_category_01_id` int(10) unsigned NOT NULL,
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `userdate_01` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_02` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_03` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_04` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `price_group_customer_category_2`
--

CREATE TABLE IF NOT EXISTS `price_group_customer_category_2` (
  `id` int(10) unsigned NOT NULL,
  `price_group_id` int(10) unsigned NOT NULL,
  `customer_category_02_id` int(10) unsigned NOT NULL,
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `userdate_01` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_02` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_03` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_04` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `project`
--

CREATE TABLE IF NOT EXISTS `project` (
  `id` int(10) unsigned NOT NULL,
  `code` varchar(10) NOT NULL,
  `description` varchar(60) NOT NULL DEFAULT '',
  `user_field_01` varchar(20) DEFAULT '',
  `user_field_02` varchar(20) DEFAULT '',
  `user_field_03` varchar(20) DEFAULT '',
  `user_field_04` varchar(20) DEFAULT '',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `project`
--

INSERT INTO `project` (`id`, `code`, `description`, `user_field_01`, `user_field_02`, `user_field_03`, `user_field_04`, `created`, `createdby`, `updated`, `updatedby`) VALUES
(1, 'default', 'default', '', '', '', '', '2012-02-19 19:27:08', 1, '2012-02-19 20:18:58', 1);

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

--
-- Table structure for table `promotion_alloc`
--

CREATE TABLE IF NOT EXISTS `promotion_alloc` (
  `id` int(10) unsigned NOT NULL,
  `promotion_hdr_id` int(10) unsigned NOT NULL,
  `alloc_type` int(2) unsigned NOT NULL DEFAULT '0',
  `company_id` int(10) unsigned NOT NULL DEFAULT '0',
  `division_id` int(10) unsigned NOT NULL DEFAULT '0',
  `customer_category_id` int(10) unsigned NOT NULL DEFAULT '0',
  `customer_category_01_id` int(10) unsigned NOT NULL DEFAULT '0',
  `customer_category_02_id` int(10) unsigned NOT NULL DEFAULT '0',
  `customer_id` int(10) unsigned NOT NULL DEFAULT '0',
  `user_id` int(10) unsigned NOT NULL DEFAULT '0',
  `item_id` int(10) unsigned NOT NULL DEFAULT '0',
  `item_group_id` int(10) unsigned NOT NULL DEFAULT '0',
  `item_group_01_id` int(10) unsigned NOT NULL DEFAULT '0',
  `item_group_02_id` int(10) unsigned NOT NULL DEFAULT '0',
  `qty_01` decimal(14,4) NOT NULL DEFAULT '0.0000',
  `qty_02` decimal(14,4) NOT NULL DEFAULT '0.0000',
  `qty_03` decimal(14,4) NOT NULL DEFAULT '0.0000',
  `qty_04` decimal(14,4) NOT NULL DEFAULT '0.0000',
  `amt_01` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `amt_02` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `amt_03` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `amt_04` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `remark_1` varchar(255) NOT NULL DEFAULT '',
  `remark_2` varchar(255) NOT NULL DEFAULT '',
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `userdate_01` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_02` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_03` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_04` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `promotion_division`
--

CREATE TABLE IF NOT EXISTS `promotion_division` (
  `id` int(10) unsigned NOT NULL,
  `division_id` int(10) unsigned NOT NULL,
  `promotion_hdr_id` int(10) NOT NULL,
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `promotion_dtl`
--

CREATE TABLE IF NOT EXISTS `promotion_dtl` (
  `id` int(10) unsigned NOT NULL,
  `promotion_hdr_id` int(10) unsigned NOT NULL,
  `line_no` int(4) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `qty` decimal(14,4) unsigned NOT NULL DEFAULT '0.0000',
  `price` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `list_price` decimal(14,6) DEFAULT '0.000000',
  `uom_id` int(10) unsigned NOT NULL,
  `uom_rate` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `description` varchar(100) DEFAULT '',
  `disc_percent_01` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_02` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_03` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_04` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_05` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_06` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_07` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_08` decimal(7,4) DEFAULT '0.0000',
  `min_price` decimal(14,6) DEFAULT '0.000000',
  `max_price` decimal(14,6) DEFAULT '0.000000',
  `min_disc_percent_01` decimal(7,4) DEFAULT '0.0000',
  `max_disc_percent_01` decimal(7,4) DEFAULT '0.0000',
  `min_disc_percent_02` decimal(7,4) DEFAULT '0.0000',
  `max_disc_percent_02` decimal(7,4) DEFAULT '0.0000',
  `min_disc_percent_03` decimal(7,4) DEFAULT '0.0000',
  `max_disc_percent_03` decimal(7,4) DEFAULT '0.0000',
  `min_disc_percent_04` decimal(7,4) DEFAULT '0.0000',
  `max_disc_percent_04` decimal(7,4) DEFAULT '0.0000',
  `min_disc_percent_05` decimal(7,4) DEFAULT '0.0000',
  `max_disc_percent_05` decimal(7,4) DEFAULT '0.0000',
  `min_disc_percent_06` decimal(7,4) DEFAULT '0.0000',
  `max_disc_percent_06` decimal(7,4) DEFAULT '0.0000',
  `min_disc_percent_07` decimal(7,4) DEFAULT '0.0000',
  `max_disc_percent_07` decimal(7,4) DEFAULT '0.0000',
  `min_disc_percent_08` decimal(7,4) DEFAULT '0.0000',
  `max_disc_percent_08` decimal(7,4) DEFAULT '0.0000',
  `disc_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `tax_group_id` int(10) unsigned NOT NULL DEFAULT '0',
  `tax_id_01` int(10) unsigned DEFAULT '0',
  `tax_percent_01` decimal(5,2) DEFAULT '0.00',
  `tax_id_02` int(10) unsigned DEFAULT '0',
  `tax_percent_02` decimal(5,2) DEFAULT '0.00',
  `tax_id_03` int(10) unsigned DEFAULT '0',
  `tax_percent_03` decimal(5,2) DEFAULT '0.00',
  `tax_id_04` int(10) unsigned DEFAULT '0',
  `tax_percent_04` decimal(5,2) DEFAULT '0.00',
  `remark` varchar(200) NOT NULL DEFAULT '',
  `group_by` varchar(20) DEFAULT '',
  `group_max` int(4) unsigned NOT NULL DEFAULT '0',
  `group_max_amt` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `group_min_amt` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `group_max_qty` int(10) unsigned NOT NULL DEFAULT '0',
  `group_min_qty` int(10) unsigned NOT NULL DEFAULT '0',
  `max_qty` int(10) unsigned NOT NULL DEFAULT '0',
  `is_lock` tinyint(1) NOT NULL DEFAULT '0',
  `user_field_01` varchar(20) DEFAULT '',
  `user_field_02` varchar(20) DEFAULT '',
  `user_field_03` varchar(20) DEFAULT '',
  `user_field_04` varchar(20) DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `promotion_hdr`
--

CREATE TABLE IF NOT EXISTS `promotion_hdr` (
  `id` int(10) unsigned NOT NULL,
  `promotion_type` char(1) NOT NULL DEFAULT '',
  `price_group_id` int(10) unsigned NOT NULL,
  `code` varchar(30) NOT NULL,
  `description` varchar(100) NOT NULL DEFAULT '',
  `description_01` varchar(100) NOT NULL DEFAULT '',
  `description_02` varchar(100) NOT NULL DEFAULT '',
  `validation_type` char(1) NOT NULL DEFAULT '',
  `valid_from` datetime NOT NULL,
  `valid_to` datetime NOT NULL,
  `min_amt` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `max_amt` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `min_qty` decimal(14,4) unsigned NOT NULL DEFAULT '0.0000',
  `max_qty` decimal(14,4) unsigned NOT NULL DEFAULT '0.0000',
  `remark` varchar(200) NOT NULL DEFAULT '',
  `is_editable` int(1) unsigned NOT NULL DEFAULT '0',
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `disc_percent_01` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_02` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_03` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_04` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_05` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_06` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_07` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_08` decimal(7,4) DEFAULT '0.0000',
  `user_field_01` varchar(20) DEFAULT '',
  `user_field_02` varchar(20) DEFAULT '',
  `user_field_03` varchar(20) DEFAULT '',
  `user_field_04` varchar(20) DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `promotion_image`
--

CREATE TABLE IF NOT EXISTS `promotion_image` (
  `id` int(10) unsigned NOT NULL,
  `promotion_hdr_id` int(10) unsigned NOT NULL,
  `description` varchar(60) DEFAULT '',
  `description1` varchar(60) DEFAULT '',
  `description2` varchar(60) DEFAULT '',
  `picture` mediumblob,
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `rd_dn_dtl`
--

CREATE TABLE IF NOT EXISTS `rd_dn_dtl` (
  `id` int(10) unsigned NOT NULL,
  `hdr_id` int(10) unsigned NOT NULL,
  `line_no` int(4) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `location_id` int(10) unsigned NOT NULL,
  `uom_id` int(10) unsigned NOT NULL,
  `uom_rate` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `price` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `list_price` decimal(14,6) DEFAULT '0.000000',
  `description` varchar(200) NOT NULL DEFAULT '',
  `shelf_id` int(10) unsigned NOT NULL DEFAULT '1',
  `batch_no` varchar(30) NOT NULL DEFAULT '',
  `serial_no` varchar(30) NOT NULL DEFAULT '',
  `stock_rotation_id` int(10) unsigned NOT NULL DEFAULT '1',
  `expiry_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `del_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `qty` decimal(14,4) NOT NULL DEFAULT '0.0000',
  `disc_percent_01` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_02` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_03` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_04` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_05` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_06` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_07` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_08` decimal(7,4) DEFAULT '0.0000',
  `disc_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `disc_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `tax_group_id` int(10) unsigned DEFAULT '0',
  `tax_id_01` int(10) unsigned DEFAULT '0',
  `tax_percent_01` decimal(5,2) DEFAULT '0.00',
  `tax_id_02` int(10) unsigned DEFAULT '0',
  `tax_percent_02` decimal(5,2) DEFAULT '0.00',
  `tax_id_03` int(10) unsigned DEFAULT '0',
  `tax_percent_03` decimal(5,2) DEFAULT '0.00',
  `tax_id_04` int(10) unsigned DEFAULT '0',
  `tax_percent_04` decimal(5,2) DEFAULT '0.00',
  `tax_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `tax_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `order_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `order_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `remark` varchar(200) NOT NULL DEFAULT '',
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `userdate_01` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_02` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_03` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_04` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `rd_dn_hdr`
--

CREATE TABLE IF NOT EXISTS `rd_dn_hdr` (
  `id` int(10) unsigned NOT NULL,
  `rd_code` varchar(30) NOT NULL,
  `dn_code` varchar(30) NOT NULL DEFAULT '',
  `ref_code` varchar(30) NOT NULL DEFAULT '',
  `doc_date` datetime NOT NULL,
  `due_date` datetime NOT NULL,
  `company_id` int(10) unsigned NOT NULL,
  `vendor_id` int(10) unsigned NOT NULL,
  `purchaser_id` int(10) unsigned NOT NULL,
  `project_id` int(10) unsigned NOT NULL,
  `division_id` int(10) unsigned NOT NULL,
  `term_id` int(10) unsigned NOT NULL,
  `term_code` varchar(20) NOT NULL,
  `term_day` int(5) NOT NULL,
  `branch_id` int(10) unsigned NOT NULL DEFAULT '0',
  `branch_code` varchar(20) NOT NULL DEFAULT '',
  `area_id` int(10) unsigned NOT NULL,
  `area_code` varchar(20) NOT NULL DEFAULT '',
  `del_address_01` varchar(100) NOT NULL DEFAULT '',
  `del_address_02` varchar(100) NOT NULL DEFAULT '',
  `del_address_03` varchar(100) NOT NULL DEFAULT '',
  `del_address_04` varchar(100) NOT NULL DEFAULT '',
  `del_attention` varchar(80) NOT NULL DEFAULT '',
  `del_postcode` varchar(10) NOT NULL DEFAULT '',
  `del_phone_01` varchar(30) NOT NULL DEFAULT '',
  `del_phone_02` varchar(30) NOT NULL DEFAULT '',
  `del_fax_01` varchar(30) NOT NULL DEFAULT '',
  `del_fax_02` varchar(30) NOT NULL DEFAULT '',
  `bill_address_01` varchar(100) NOT NULL DEFAULT '',
  `bill_address_02` varchar(100) NOT NULL DEFAULT '',
  `bill_address_03` varchar(100) NOT NULL DEFAULT '',
  `bill_address_04` varchar(100) NOT NULL DEFAULT '',
  `bill_attention` varchar(80) NOT NULL DEFAULT '',
  `bill_postcode` varchar(10) NOT NULL DEFAULT '',
  `bill_phone_01` varchar(30) NOT NULL DEFAULT '',
  `bill_phone_02` varchar(30) NOT NULL DEFAULT '',
  `bill_fax_01` varchar(30) NOT NULL DEFAULT '',
  `bill_fax_02` varchar(30) NOT NULL DEFAULT '',
  `description` varchar(200) NOT NULL DEFAULT '',
  `currency_rate` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `currency_id` int(10) unsigned NOT NULL,
  `disc_percent_01` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_02` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_03` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_04` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_05` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_06` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_07` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_08` decimal(7,4) DEFAULT '0.0000',
  `disc_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `disc_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `tax_group_id` int(10) unsigned DEFAULT '0',
  `tax_id_01` int(10) unsigned DEFAULT '0',
  `tax_percent_01` decimal(5,2) DEFAULT '0.00',
  `tax_id_02` int(10) unsigned DEFAULT '0',
  `tax_percent_02` decimal(5,2) DEFAULT '0.00',
  `tax_id_03` int(10) unsigned DEFAULT '0',
  `tax_percent_03` decimal(5,2) DEFAULT '0.00',
  `tax_id_04` int(10) unsigned DEFAULT '0',
  `tax_percent_04` decimal(5,2) DEFAULT '0.00',
  `tax_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `tax_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `order_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `order_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `is_printed` tinyint(1) NOT NULL DEFAULT '0',
  `is_dn_printed` tinyint(1) NOT NULL DEFAULT '0',
  `is_exported` tinyint(1) NOT NULL DEFAULT '0',
  `status` int(2) NOT NULL DEFAULT '0',
  `remark_01` varchar(200) NOT NULL DEFAULT '',
  `remark_02` varchar(200) NOT NULL DEFAULT '',
  `voided` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `voidedby` int(10) DEFAULT '0',
  `void_reason_id` int(10) DEFAULT '0',
  `void_remark` text,
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `userdate_01` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_02` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_03` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_04` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `dn_created` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `dn_createdby` int(10) unsigned DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `reason`
--

CREATE TABLE IF NOT EXISTS `reason` (
  `id` int(10) unsigned NOT NULL,
  `code` varchar(10) NOT NULL,
  `description` varchar(60) NOT NULL DEFAULT '',
  `type` char(1) DEFAULT '',
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `userdate_01` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_02` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_03` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_04` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `reason`
--

INSERT INTO `reason` (`id`, `code`, `description`, `type`, `userfield_01`, `userfield_02`, `userfield_03`, `userfield_04`, `usernumber_01`, `usernumber_02`, `usernumber_03`, `usernumber_04`, `useryesno_01`, `useryesno_02`, `useryesno_03`, `useryesno_04`, `userdate_01`, `userdate_02`, `userdate_03`, `userdate_04`, `created`, `createdby`, `updated`, `updatedby`) VALUES
(1, '-', '-', '', '', '', '', '', '0.0000', '0.0000', '0.0000', '0.0000', 0, 0, 0, 0, '1970-01-01 00:00:00', '1970-01-01 00:00:00', '1970-01-01 00:00:00', '1970-01-01 00:00:00', '2012-02-19 19:27:08', 1, '2012-02-19 20:18:58', 1);

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

--
-- Table structure for table `return_tracking`
--

CREATE TABLE IF NOT EXISTS `return_tracking` (
  `id` int(10) unsigned NOT NULL,
  `customer_id` int(10) unsigned NOT NULL,
  `salesman_id` int(10) unsigned DEFAULT NULL,
  `sales_ret_hdr_id` int(10) unsigned DEFAULT NULL,
  `sales_ret_hdr_date` datetime DEFAULT NULL,
  `sales_ret_dtl_id` int(10) unsigned DEFAULT NULL,
  `sales_ret_dtl_date` datetime DEFAULT NULL,
  `rr_cn_hdr_id` int(10) unsigned DEFAULT NULL,
  `rr_cn_hdr_date` datetime DEFAULT NULL,
  `rr_cn_dtl_id` int(10) unsigned DEFAULT NULL,
  `rr_cn_dtl_date` datetime DEFAULT NULL,
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `route`
--

CREATE TABLE IF NOT EXISTS `route` (
  `id` int(10) unsigned NOT NULL,
  `code` varchar(30) NOT NULL,
  `description` varchar(255) NOT NULL DEFAULT '',
  `vehicle_code` varchar(20) NOT NULL,
  `schedule` varchar(2047) NOT NULL DEFAULT '',
  `route_type` char(1) NOT NULL DEFAULT 'n',
  `max_weight` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `max_length` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `max_width` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `max_height` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `division_id` int(10) unsigned NOT NULL DEFAULT '0',
  `userdatetime_01` datetime NOT NULL,
  `userdatetime_02` datetime NOT NULL,
  `userdatetime_03` datetime NOT NULL,
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `route`
--

INSERT INTO `route` (`id`, `code`, `description`, `vehicle_code`, `schedule`, `route_type`, `max_weight`, `max_length`, `max_width`, `max_height`, `division_id`, `userdatetime_01`, `userdatetime_02`, `userdatetime_03`, `userfield_01`, `userfield_02`, `userfield_03`, `usernumber_01`, `usernumber_02`, `usernumber_03`, `useryesno_01`, `useryesno_02`, `useryesno_03`, `created`, `createdby`, `updated`, `updatedby`) VALUES
(1, '-', '', '- ', '', 'n', '0.0000', '0.0000', '0.0000', '0.0000', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '', '', '0.0000', '0.0000', '0.0000', 0, 0, 0, '2011-10-31 23:49:59', 1, '2011-10-31 23:49:59', 1);

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

--
-- Table structure for table `route_criteria`
--

CREATE TABLE IF NOT EXISTS `route_criteria` (
  `id` int(10) unsigned NOT NULL,
  `route_id` int(10) unsigned NOT NULL,
  `line_no` int(4) unsigned NOT NULL DEFAULT '0',
  `street_name` varchar(255) NOT NULL DEFAULT '',
  `neighborhood` varchar(255) NOT NULL DEFAULT '',
  `city_name` varchar(255) NOT NULL DEFAULT '',
  `state_name` varchar(255) NOT NULL DEFAULT '',
  `postcode` varchar(255) NOT NULL DEFAULT '',
  `country` varchar(255) NOT NULL DEFAULT '',
  `userdatetime_01` datetime NOT NULL,
  `userdatetime_02` datetime NOT NULL,
  `userdatetime_03` datetime NOT NULL,
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `route_customer`
--

CREATE TABLE IF NOT EXISTS `route_customer` (
  `id` int(10) unsigned NOT NULL,
  `route_id` int(10) unsigned NOT NULL,
  `customer_id` int(10) unsigned NOT NULL,
  `branch_id` int(10) unsigned NOT NULL DEFAULT '0',
  `code` varchar(30) NOT NULL,
  `vehicle_code` varchar(20) NOT NULL,
  `schedule` varchar(2047) NOT NULL DEFAULT '',
  `route_type` char(1) NOT NULL DEFAULT 'n',
  `line_no` int(4) unsigned NOT NULL DEFAULT '0',
  `max_weight` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `max_length` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `max_width` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `max_height` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `division_id` int(10) unsigned NOT NULL DEFAULT '0',
  `userdatetime_01` datetime NOT NULL,
  `userdatetime_02` datetime NOT NULL,
  `userdatetime_03` datetime NOT NULL,
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `route_division`
--

CREATE TABLE IF NOT EXISTS `route_division` (
  `id` int(10) unsigned NOT NULL,
  `route_id` int(10) unsigned NOT NULL,
  `division_id` int(10) unsigned NOT NULL,
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `route_plan`
--

CREATE TABLE IF NOT EXISTS `route_plan` (
  `id` int(10) unsigned NOT NULL,
  `division_id` int(10) unsigned NOT NULL,
  `customer_id` int(10) unsigned NOT NULL,
  `branch_id` int(10) unsigned NOT NULL DEFAULT '0',
  `branch_code` varchar(20) DEFAULT '',
  `area_id` int(10) unsigned NOT NULL,
  `area_code` varchar(20) DEFAULT '',
  `salesman_id` int(10) unsigned NOT NULL,
  `lat` float(10,6) NOT NULL,
  `lng` float(10,6) NOT NULL,
  `start_date` datetime NOT NULL,
  `end_date` datetime NOT NULL,
  `route_time` datetime NOT NULL,
  `description` varchar(200) NOT NULL DEFAULT '',
  `ref_no_01` varchar(30) NOT NULL DEFAULT '',
  `ref_no_02` varchar(30) NOT NULL DEFAULT '',
  `remark` varchar(200) NOT NULL DEFAULT '',
  `is_repeat` tinyint(1) NOT NULL DEFAULT '0',
  `repeat_type` varchar(3) NOT NULL,
  `repeat_week` int(2) unsigned NOT NULL DEFAULT '0',
  `repeat_on` varchar(30) NOT NULL,
  `repeat_end_type` varchar(3) NOT NULL,
  `repeat_end_occur` int(2) unsigned NOT NULL DEFAULT '0',
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `is_visit` tinyint(1) NOT NULL DEFAULT '0',
  `planned_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `route_plan_import`
--

CREATE TABLE IF NOT EXISTS `route_plan_import` (
  `id` int(10) unsigned NOT NULL,
  `customer_id` int(10) unsigned NOT NULL,
  `salesman_id` int(10) unsigned NOT NULL,
  `division_id` int(10) unsigned NOT NULL,
  `branch_id` int(10) unsigned NOT NULL DEFAULT '0',
  `area_id` int(10) unsigned NOT NULL,
  `visit_01` varchar(30) NOT NULL DEFAULT '',
  `visit_02` varchar(30) NOT NULL DEFAULT '',
  `visit_03` varchar(30) NOT NULL DEFAULT '',
  `visit_04` varchar(30) NOT NULL DEFAULT '',
  `visit_05` varchar(30) NOT NULL DEFAULT '',
  `visit_06` varchar(30) NOT NULL DEFAULT '',
  `visit_07` varchar(30) NOT NULL DEFAULT '',
  `visit_08` varchar(30) NOT NULL DEFAULT '',
  `visit_09` varchar(30) NOT NULL DEFAULT '',
  `visit_10` varchar(30) NOT NULL DEFAULT '',
  `visit_11` varchar(30) NOT NULL DEFAULT '',
  `visit_12` varchar(30) NOT NULL DEFAULT '',
  `visit_13` varchar(30) NOT NULL DEFAULT '',
  `visit_14` varchar(30) NOT NULL DEFAULT '',
  `visit_15` varchar(30) NOT NULL DEFAULT '',
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `userdate_01` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_02` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_03` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_04` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `rr_cn_dtl`
--

CREATE TABLE IF NOT EXISTS `rr_cn_dtl` (
  `id` int(10) unsigned NOT NULL,
  `hdr_id` int(10) unsigned NOT NULL,
  `line_no` int(4) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `location_id` int(10) unsigned NOT NULL,
  `uom_id` int(10) unsigned NOT NULL,
  `uom_rate` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `price` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `list_price` decimal(14,6) DEFAULT '0.000000',
  `description` varchar(200) NOT NULL DEFAULT '',
  `shelf_id` int(10) unsigned NOT NULL DEFAULT '1',
  `batch_no` varchar(30) NOT NULL DEFAULT '',
  `serial_no` varchar(30) NOT NULL DEFAULT '',
  `stock_rotation_id` int(10) unsigned NOT NULL DEFAULT '1',
  `promotion_hdr_id` int(10) NOT NULL DEFAULT '0',
  `expiry_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `del_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `qty` decimal(14,4) NOT NULL DEFAULT '0.0000',
  `disc_percent_01` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_02` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_03` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_04` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_05` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_06` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_07` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_08` decimal(7,4) DEFAULT '0.0000',
  `disc_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `disc_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `tax_group_id` int(10) unsigned DEFAULT '0',
  `tax_id_01` int(10) unsigned DEFAULT '0',
  `tax_percent_01` decimal(5,2) DEFAULT '0.00',
  `tax_id_02` int(10) unsigned DEFAULT '0',
  `tax_percent_02` decimal(5,2) DEFAULT '0.00',
  `tax_id_03` int(10) unsigned DEFAULT '0',
  `tax_percent_03` decimal(5,2) DEFAULT '0.00',
  `tax_id_04` int(10) unsigned DEFAULT '0',
  `tax_percent_04` decimal(5,2) DEFAULT '0.00',
  `tax_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `tax_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `order_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `order_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `remark` varchar(200) NOT NULL DEFAULT '',
  `foc_flag` tinyint(1) DEFAULT '0',
  `promo_uuid` varchar(40) NOT NULL DEFAULT '',
  `promo_qty` decimal(14,4) unsigned NOT NULL DEFAULT '0.0000',
  `reason_id` int(10) NOT NULL DEFAULT '0',
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `userdate_01` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_02` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_03` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_04` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `rr_cn_hdr`
--

CREATE TABLE IF NOT EXISTS `rr_cn_hdr` (
  `id` int(10) unsigned NOT NULL,
  `rr_code` varchar(30) NOT NULL,
  `cn_code` varchar(30) NOT NULL DEFAULT '',
  `ref_code` varchar(30) NOT NULL DEFAULT '',
  `doc_date` datetime NOT NULL,
  `due_date` datetime NOT NULL,
  `company_id` int(10) unsigned NOT NULL,
  `customer_id` int(10) unsigned NOT NULL,
  `salesman_id` int(10) unsigned NOT NULL,
  `project_id` int(10) unsigned NOT NULL,
  `division_id` int(10) unsigned NOT NULL,
  `term_id` int(10) unsigned NOT NULL,
  `term_code` varchar(20) NOT NULL,
  `term_day` int(5) NOT NULL,
  `branch_id` int(10) unsigned NOT NULL DEFAULT '0',
  `branch_code` varchar(20) NOT NULL DEFAULT '',
  `area_id` int(10) unsigned NOT NULL,
  `area_code` varchar(20) NOT NULL DEFAULT '',
  `del_address_01` varchar(100) NOT NULL DEFAULT '',
  `del_address_02` varchar(100) NOT NULL DEFAULT '',
  `del_address_03` varchar(100) NOT NULL DEFAULT '',
  `del_address_04` varchar(100) NOT NULL DEFAULT '',
  `del_attention` varchar(80) NOT NULL DEFAULT '',
  `del_postcode` varchar(10) NOT NULL DEFAULT '',
  `del_phone_01` varchar(30) NOT NULL DEFAULT '',
  `del_phone_02` varchar(30) NOT NULL DEFAULT '',
  `del_fax_01` varchar(30) NOT NULL DEFAULT '',
  `del_fax_02` varchar(30) NOT NULL DEFAULT '',
  `bill_address_01` varchar(100) NOT NULL DEFAULT '',
  `bill_address_02` varchar(100) NOT NULL DEFAULT '',
  `bill_address_03` varchar(100) NOT NULL DEFAULT '',
  `bill_address_04` varchar(100) NOT NULL DEFAULT '',
  `bill_attention` varchar(80) NOT NULL DEFAULT '',
  `bill_postcode` varchar(10) NOT NULL DEFAULT '',
  `bill_phone_01` varchar(30) NOT NULL DEFAULT '',
  `bill_phone_02` varchar(30) NOT NULL DEFAULT '',
  `bill_fax_01` varchar(30) NOT NULL DEFAULT '',
  `bill_fax_02` varchar(30) NOT NULL DEFAULT '',
  `description` varchar(200) NOT NULL DEFAULT '',
  `currency_rate` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `currency_id` int(10) unsigned NOT NULL,
  `disc_percent_01` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_02` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_03` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_04` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_05` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_06` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_07` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_08` decimal(7,4) DEFAULT '0.0000',
  `disc_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `disc_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `tax_group_id` int(10) unsigned DEFAULT '0',
  `tax_id_01` int(10) unsigned DEFAULT '0',
  `tax_percent_01` decimal(5,2) DEFAULT '0.00',
  `tax_id_02` int(10) unsigned DEFAULT '0',
  `tax_percent_02` decimal(5,2) DEFAULT '0.00',
  `tax_id_03` int(10) unsigned DEFAULT '0',
  `tax_percent_03` decimal(5,2) DEFAULT '0.00',
  `tax_id_04` int(10) unsigned DEFAULT '0',
  `tax_percent_04` decimal(5,2) DEFAULT '0.00',
  `tax_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `tax_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `order_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `order_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `is_printed` tinyint(1) NOT NULL DEFAULT '0',
  `is_cn_printed` tinyint(1) NOT NULL DEFAULT '0',
  `is_exported` tinyint(1) NOT NULL DEFAULT '0',
  `status` int(2) NOT NULL DEFAULT '0',
  `remark_01` varchar(200) NOT NULL DEFAULT '',
  `remark_02` varchar(200) NOT NULL DEFAULT '',
  `cn_created` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `cn_createdby` int(10) unsigned DEFAULT '0',
  `voided` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `voidedby` int(10) DEFAULT '0',
  `void_reason_id` int(10) DEFAULT '0',
  `void_remark` text,
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `userdate_01` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_02` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_03` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_04` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `salesman_commission`
--

CREATE TABLE IF NOT EXISTS `salesman_commission` (
  `id` int(10) unsigned NOT NULL,
  `user_id` int(10) unsigned NOT NULL,
  `doc_type` char(3) NOT NULL,
  `age_01` int(6) unsigned NOT NULL DEFAULT '0',
  `commission_01` decimal(7,4) NOT NULL DEFAULT '0.0000',
  `penalty_01` decimal(7,4) NOT NULL DEFAULT '0.0000',
  `age_02` int(6) unsigned NOT NULL DEFAULT '0',
  `commission_02` decimal(7,4) NOT NULL DEFAULT '0.0000',
  `penalty_02` decimal(7,4) NOT NULL DEFAULT '0.0000',
  `age_03` int(6) unsigned NOT NULL DEFAULT '0',
  `commission_03` decimal(7,4) NOT NULL DEFAULT '0.0000',
  `penalty_03` decimal(7,4) NOT NULL DEFAULT '0.0000',
  `age_04` int(6) unsigned NOT NULL DEFAULT '0',
  `commission_04` decimal(7,4) NOT NULL DEFAULT '0.0000',
  `penalty_04` decimal(7,4) NOT NULL DEFAULT '0.0000',
  `age_05` int(6) unsigned NOT NULL DEFAULT '0',
  `commission_05` decimal(7,4) NOT NULL DEFAULT '0.0000',
  `penalty_05` decimal(7,4) NOT NULL DEFAULT '0.0000',
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `salesman_item_group`
--

CREATE TABLE IF NOT EXISTS `salesman_item_group` (
  `id` int(10) unsigned NOT NULL,
  `customer_id` int(11) NOT NULL,
  `division_id` int(10) unsigned NOT NULL DEFAULT '0',
  `item_group_id` int(11) NOT NULL,
  `item_group_salesman_id` int(11) NOT NULL,
  `item_group_1_id` int(11) NOT NULL,
  `item_group_1_salesman_id` int(11) NOT NULL,
  `item_group_2_id` int(11) NOT NULL,
  `item_group_2_salesman_id` int(11) NOT NULL,
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `salesteam`
--

CREATE TABLE IF NOT EXISTS `salesteam` (
  `id` int(10) unsigned NOT NULL,
  `division_id` int(10) unsigned NOT NULL,
  `code` varchar(20) DEFAULT '',
  `description` varchar(255) NOT NULL DEFAULT '',
  `status` tinyint(1) NOT NULL DEFAULT '1',
  `remark_01` varchar(255) NOT NULL DEFAULT '',
  `remark_02` varchar(255) NOT NULL DEFAULT '',
  `remark_03` varchar(255) NOT NULL DEFAULT '',
  `remark_04` varchar(255) NOT NULL DEFAULT '',
  `userfield_01` varchar(255) DEFAULT '',
  `userfield_02` varchar(255) DEFAULT '',
  `userfield_03` varchar(255) DEFAULT '',
  `userfield_04` varchar(255) DEFAULT '',
  `usernumber_01` decimal(11,4) DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) DEFAULT '0.0000',
  `useryesno_01` tinyint(1) DEFAULT '0',
  `useryesno_02` tinyint(1) DEFAULT '0',
  `useryesno_03` tinyint(1) DEFAULT '0',
  `useryesno_04` tinyint(1) DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `salesteam_member`
--

CREATE TABLE IF NOT EXISTS `salesteam_member` (
  `id` int(10) unsigned NOT NULL,
  `salesteam_id` int(10) unsigned NOT NULL,
  `user_id` int(10) unsigned NOT NULL,
  `priority` int(1) unsigned NOT NULL DEFAULT '0',
  `userfield_01` varchar(255) DEFAULT '',
  `userfield_02` varchar(255) DEFAULT '',
  `userfield_03` varchar(255) DEFAULT '',
  `userfield_04` varchar(255) DEFAULT '',
  `usernumber_01` decimal(11,4) DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) DEFAULT '0.0000',
  `useryesno_01` tinyint(1) DEFAULT '0',
  `useryesno_02` tinyint(1) DEFAULT '0',
  `useryesno_03` tinyint(1) DEFAULT '0',
  `useryesno_04` tinyint(1) DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `sales_odr_dtl`
--

CREATE TABLE IF NOT EXISTS `sales_odr_dtl` (
  `id` int(10) unsigned NOT NULL,
  `hdr_id` int(10) unsigned NOT NULL,
  `line_no` int(4) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `location_id` int(10) unsigned NOT NULL,
  `uom_id` int(10) unsigned NOT NULL,
  `uom_rate` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `price` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `list_price` decimal(14,6) DEFAULT '0.000000',
  `description` varchar(200) NOT NULL DEFAULT '',
  `shelf_id` int(10) unsigned NOT NULL DEFAULT '1',
  `batch_no` varchar(30) NOT NULL DEFAULT '',
  `serial_no` varchar(30) NOT NULL DEFAULT '',
  `stock_rotation_id` int(10) unsigned NOT NULL DEFAULT '1',
  `promotion_hdr_id` int(10) unsigned DEFAULT NULL,
  `expiry_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `del_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `qty` decimal(14,4) unsigned NOT NULL DEFAULT '0.0000',
  `sent_qty` decimal(14,4) unsigned NOT NULL DEFAULT '0.0000',
  `disc_percent_01` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_02` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_03` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_04` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_05` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_06` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_07` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_08` decimal(7,4) DEFAULT '0.0000',
  `disc_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `disc_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `tax_group_id` int(10) unsigned DEFAULT '0',
  `tax_id_01` int(10) unsigned DEFAULT '0',
  `tax_percent_01` decimal(5,2) DEFAULT '0.00',
  `tax_id_02` int(10) unsigned DEFAULT '0',
  `tax_percent_02` decimal(5,2) DEFAULT '0.00',
  `tax_id_03` int(10) unsigned DEFAULT '0',
  `tax_percent_03` decimal(5,2) DEFAULT '0.00',
  `tax_id_04` int(10) unsigned DEFAULT '0',
  `tax_percent_04` decimal(5,2) DEFAULT '0.00',
  `tax_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `tax_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `order_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `order_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `remark` varchar(200) NOT NULL DEFAULT '',
  `is_closed` tinyint(1) NOT NULL DEFAULT '0',
  `foc_flag` tinyint(1) DEFAULT '0',
  `promo_uuid` varchar(40) DEFAULT NULL,
  `promo_qty` decimal(14,4) unsigned NOT NULL DEFAULT '0.0000',
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `userdate_01` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_02` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_03` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_04` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `sales_odr_dtl_c`
--

CREATE TABLE IF NOT EXISTS `sales_odr_dtl_c` (
  `id` int(10) unsigned NOT NULL,
  `sales_odr_hdr_id` int(10) unsigned NOT NULL,
  `hdr_id` int(10) unsigned NOT NULL,
  `line_no` int(4) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `location_id` int(10) unsigned NOT NULL,
  `uom_id` int(10) unsigned NOT NULL,
  `uom_rate` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `price` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `list_price` decimal(14,6) DEFAULT '0.000000',
  `description` varchar(200) NOT NULL DEFAULT '',
  `shelf_id` int(10) unsigned NOT NULL DEFAULT '1',
  `batch_no` varchar(30) NOT NULL DEFAULT '',
  `serial_no` varchar(30) NOT NULL DEFAULT '',
  `stock_rotation_id` int(10) unsigned NOT NULL DEFAULT '1',
  `promotion_hdr_id` int(10) unsigned DEFAULT NULL,
  `expiry_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `del_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `qty` decimal(14,4) unsigned NOT NULL DEFAULT '0.0000',
  `sent_qty` decimal(14,4) unsigned NOT NULL DEFAULT '0.0000',
  `disc_percent_01` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_02` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_03` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_04` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_05` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_06` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_07` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_08` decimal(7,4) DEFAULT '0.0000',
  `disc_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `disc_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `tax_group_id` int(10) unsigned DEFAULT '0',
  `tax_id_01` int(10) unsigned DEFAULT '0',
  `tax_percent_01` decimal(5,2) DEFAULT '0.00',
  `tax_id_02` int(10) unsigned DEFAULT '0',
  `tax_percent_02` decimal(5,2) DEFAULT '0.00',
  `tax_id_03` int(10) unsigned DEFAULT '0',
  `tax_percent_03` decimal(5,2) DEFAULT '0.00',
  `tax_id_04` int(10) unsigned DEFAULT '0',
  `tax_percent_04` decimal(5,2) DEFAULT '0.00',
  `tax_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `tax_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `order_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `order_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `remark` varchar(200) NOT NULL DEFAULT '',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `sales_odr_hdr`
--

CREATE TABLE IF NOT EXISTS `sales_odr_hdr` (
  `id` int(10) unsigned NOT NULL,
  `doc_code` varchar(30) NOT NULL,
  `ref_code` varchar(30) NOT NULL DEFAULT '',
  `doc_date` datetime NOT NULL,
  `order_type` char(1) NOT NULL,
  `company_id` int(10) unsigned NOT NULL,
  `customer_id` int(10) unsigned NOT NULL,
  `salesman_id` int(10) unsigned NOT NULL,
  `project_id` int(10) unsigned NOT NULL DEFAULT '1',
  `division_id` int(10) unsigned NOT NULL,
  `term_id` int(10) unsigned NOT NULL,
  `term_code` varchar(20) NOT NULL,
  `term_day` int(5) NOT NULL,
  `branch_id` int(10) unsigned NOT NULL DEFAULT '0',
  `branch_code` varchar(20) DEFAULT '',
  `area_id` int(10) unsigned NOT NULL,
  `area_code` varchar(20) DEFAULT '',
  `del_address_01` varchar(100) NOT NULL DEFAULT '',
  `del_address_02` varchar(100) NOT NULL DEFAULT '',
  `del_address_03` varchar(100) NOT NULL DEFAULT '',
  `del_address_04` varchar(100) NOT NULL DEFAULT '',
  `del_attention` varchar(80) NOT NULL DEFAULT '',
  `del_postcode` varchar(10) NOT NULL DEFAULT '',
  `del_phone_01` varchar(30) NOT NULL DEFAULT '',
  `del_phone_02` varchar(30) NOT NULL DEFAULT '',
  `del_fax_01` varchar(30) NOT NULL DEFAULT '',
  `del_fax_02` varchar(30) NOT NULL DEFAULT '',
  `description` varchar(200) NOT NULL DEFAULT '',
  `currency_rate` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `currency_id` int(10) unsigned NOT NULL,
  `disc_percent_01` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_02` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_03` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_04` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_05` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_06` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_07` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_08` decimal(7,4) DEFAULT '0.0000',
  `disc_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `disc_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `tax_group_id` int(10) unsigned NOT NULL DEFAULT '0',
  `tax_id_01` int(10) unsigned DEFAULT '0',
  `tax_percent_01` decimal(5,2) DEFAULT '0.00',
  `tax_id_02` int(10) unsigned DEFAULT '0',
  `tax_percent_02` decimal(5,2) DEFAULT '0.00',
  `tax_id_03` int(10) unsigned DEFAULT '0',
  `tax_percent_03` decimal(5,2) DEFAULT '0.00',
  `tax_id_04` int(10) unsigned DEFAULT '0',
  `tax_percent_04` decimal(5,2) DEFAULT '0.00',
  `tax_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `tax_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `order_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `order_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `remark_01` varchar(200) NOT NULL DEFAULT '',
  `remark_02` varchar(200) NOT NULL DEFAULT '',
  `is_printed` tinyint(1) NOT NULL DEFAULT '0',
  `is_exported` tinyint(1) NOT NULL DEFAULT '0',
  `status` int(2) NOT NULL DEFAULT '0',
  `voided` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `voidedby` int(10) DEFAULT '0',
  `void_reason_id` int(10) DEFAULT '0',
  `void_remark` text,
  `location_check_in_id` int(10) unsigned NOT NULL DEFAULT '0',
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `userdate_01` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_02` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_03` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_04` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `sales_odr_hdr_c`
--

CREATE TABLE IF NOT EXISTS `sales_odr_hdr_c` (
  `id` int(10) unsigned NOT NULL,
  `sales_odr_hdr_id` int(10) unsigned NOT NULL,
  `doc_code` varchar(30) NOT NULL,
  `ref_code` varchar(30) NOT NULL DEFAULT '',
  `doc_date` datetime NOT NULL,
  `order_type` char(1) NOT NULL,
  `company_id` int(10) unsigned NOT NULL,
  `customer_id` int(10) unsigned NOT NULL,
  `salesman_id` int(10) unsigned NOT NULL,
  `project_id` int(10) unsigned NOT NULL DEFAULT '1',
  `division_id` int(10) unsigned NOT NULL,
  `term_id` int(10) unsigned NOT NULL,
  `term_code` varchar(20) NOT NULL,
  `term_day` int(5) NOT NULL,
  `branch_id` int(10) unsigned NOT NULL DEFAULT '0',
  `branch_code` varchar(20) DEFAULT '',
  `area_id` int(10) unsigned NOT NULL,
  `area_code` varchar(20) DEFAULT '',
  `del_address_01` varchar(100) NOT NULL DEFAULT '',
  `del_address_02` varchar(100) NOT NULL DEFAULT '',
  `del_address_03` varchar(100) NOT NULL DEFAULT '',
  `del_address_04` varchar(100) NOT NULL DEFAULT '',
  `del_attention` varchar(80) NOT NULL DEFAULT '',
  `del_postcode` varchar(10) NOT NULL DEFAULT '',
  `del_phone_01` varchar(30) NOT NULL DEFAULT '',
  `del_phone_02` varchar(30) NOT NULL DEFAULT '',
  `del_fax_01` varchar(30) NOT NULL DEFAULT '',
  `del_fax_02` varchar(30) NOT NULL DEFAULT '',
  `description` varchar(200) NOT NULL DEFAULT '',
  `currency_rate` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `currency_id` int(10) unsigned NOT NULL,
  `disc_percent_01` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_02` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_03` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_04` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_05` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_06` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_07` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_08` decimal(7,4) DEFAULT '0.0000',
  `disc_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `disc_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `tax_group_id` int(10) unsigned NOT NULL DEFAULT '0',
  `tax_id_01` int(10) unsigned DEFAULT '0',
  `tax_percent_01` decimal(5,2) DEFAULT '0.00',
  `tax_id_02` int(10) unsigned DEFAULT '0',
  `tax_percent_02` decimal(5,2) DEFAULT '0.00',
  `tax_id_03` int(10) unsigned DEFAULT '0',
  `tax_percent_03` decimal(5,2) DEFAULT '0.00',
  `tax_id_04` int(10) unsigned DEFAULT '0',
  `tax_percent_04` decimal(5,2) DEFAULT '0.00',
  `tax_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `tax_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `order_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `order_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `remark_01` varchar(200) NOT NULL DEFAULT '',
  `remark_02` varchar(200) NOT NULL DEFAULT '',
  `voided` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL,
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `userdate_01` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_02` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_03` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_04` datetime NOT NULL DEFAULT '1970-01-01 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `sales_reporting`
--

CREATE TABLE IF NOT EXISTS `sales_reporting` (
  `id` varchar(30) NOT NULL,
  `division_id` int(10) unsigned NOT NULL,
  `division_code` varchar(30) NOT NULL,
  `division_desc` varchar(30) NOT NULL,
  `customer_id` int(10) unsigned NOT NULL,
  `customer_code` varchar(30) NOT NULL,
  `customer_name` varchar(100) NOT NULL,
  `salesman_id` int(10) unsigned NOT NULL,
  `salesman_firstname` varchar(100) NOT NULL,
  `salesman_lastname` varchar(100) NOT NULL,
  `term_id` int(10) unsigned NOT NULL DEFAULT '1',
  `term_day` int(10) NOT NULL DEFAULT '0',
  `term_code` varchar(20) NOT NULL DEFAULT '',
  `doc_type` char(3) NOT NULL,
  `doc_id` int(10) unsigned NOT NULL,
  `doc_no` varchar(50) NOT NULL,
  `doc_date` datetime NOT NULL,
  `month` int(2) unsigned NOT NULL,
  `year` int(4) unsigned NOT NULL,
  `due_date` datetime NOT NULL,
  `currency_id` int(10) unsigned NOT NULL,
  `currency_code` varchar(10) NOT NULL,
  `currency_rate` decimal(11,4) NOT NULL,
  `description` varchar(200) NOT NULL DEFAULT '',
  `sign` int(1) NOT NULL,
  `ref_no_01` varchar(30) NOT NULL DEFAULT '',
  `ref_no_02` varchar(100) NOT NULL DEFAULT '',
  `remark` varchar(200) NOT NULL DEFAULT '',
  `area_id` int(10) unsigned NOT NULL,
  `area_code` varchar(20) NOT NULL,
  `area_desc` varchar(60) NOT NULL,
  `customer_category_id` int(10) unsigned NOT NULL,
  `customer_category_code` varchar(20) NOT NULL,
  `customer_category_desc` varchar(60) NOT NULL,
  `customer_category_1_id` int(10) unsigned NOT NULL,
  `customer_category_1_code` varchar(20) NOT NULL,
  `customer_category_1_desc` varchar(60) NOT NULL,
  `customer_category_2_id` int(10) unsigned NOT NULL,
  `customer_category_2_code` varchar(20) NOT NULL,
  `customer_category_2_desc` varchar(60) NOT NULL,
  `price_group_id` int(10) unsigned NOT NULL,
  `price_group_code` varchar(10) NOT NULL,
  `price_group_desc` varchar(60) NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `item_code` varchar(30) NOT NULL,
  `item_desc` varchar(60) DEFAULT NULL,
  `item_group_id` int(10) unsigned NOT NULL,
  `item_group_code` varchar(10) NOT NULL,
  `item_group_desc` varchar(60) NOT NULL,
  `item_group_1_id` int(10) unsigned NOT NULL,
  `item_group_1_code` varchar(10) NOT NULL,
  `item_group_1_desc` varchar(60) NOT NULL,
  `item_group_2_id` int(10) unsigned NOT NULL,
  `item_group_2_code` varchar(10) NOT NULL,
  `item_group_2_desc` varchar(60) NOT NULL,
  `max_uom_rate` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `promotion_hdr_id` int(10) NOT NULL DEFAULT '0',
  `promotion_code` varchar(30) DEFAULT NULL,
  `promotion_desc` varchar(100) DEFAULT NULL,
  `promotion_desc_1` varchar(100) DEFAULT NULL,
  `promotion_desc_2` varchar(100) DEFAULT NULL,
  `valid_from` datetime DEFAULT NULL,
  `valid_to` datetime DEFAULT NULL,
  `promotion_type` char(1) DEFAULT '',
  `location_id` int(10) unsigned NOT NULL,
  `location_code` varchar(15) NOT NULL,
  `location_desc` varchar(60) NOT NULL DEFAULT '',
  `price` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `sales_qty` decimal(14,4) NOT NULL DEFAULT '0.0000',
  `return_qty` decimal(14,4) NOT NULL DEFAULT '0.0000',
  `sales_qty_case` decimal(14,4) NOT NULL DEFAULT '0.0000',
  `return_qty_case` decimal(14,4) NOT NULL DEFAULT '0.0000',
  `item_disc_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `footer_disc_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `sales_exc_tax_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `sales_tax_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `sales_inc_tax_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `return_exc_tax_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `return_tax_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `return_inc_tax_amt` decimal(14,6) NOT NULL DEFAULT '0.000000'
) ENGINE=InnoDB DEFAULT CHARSET=utf8
/*!50100 PARTITION BY RANGE (TO_DAYS(doc_date))
(PARTITION sr12014 VALUES LESS THAN (735688) ENGINE = InnoDB,
 PARTITION sr22014 VALUES LESS THAN (735779) ENGINE = InnoDB,
 PARTITION sr32014 VALUES LESS THAN (735871) ENGINE = InnoDB,
 PARTITION sr42014 VALUES LESS THAN (735963) ENGINE = InnoDB,
 PARTITION sr12015 VALUES LESS THAN (736053) ENGINE = InnoDB,
 PARTITION sr22015 VALUES LESS THAN (736144) ENGINE = InnoDB,
 PARTITION sr32015 VALUES LESS THAN (736236) ENGINE = InnoDB,
 PARTITION sr42015 VALUES LESS THAN (736328) ENGINE = InnoDB,
 PARTITION sr12016 VALUES LESS THAN (736419) ENGINE = InnoDB,
 PARTITION sr22016 VALUES LESS THAN (736510) ENGINE = InnoDB,
 PARTITION sr32016 VALUES LESS THAN (736602) ENGINE = InnoDB,
 PARTITION sr42016 VALUES LESS THAN (736694) ENGINE = InnoDB,
 PARTITION sr12017 VALUES LESS THAN (736784) ENGINE = InnoDB,
 PARTITION sr22017 VALUES LESS THAN (736875) ENGINE = InnoDB,
 PARTITION sr32017 VALUES LESS THAN (736967) ENGINE = InnoDB,
 PARTITION sr42017 VALUES LESS THAN (737059) ENGINE = InnoDB,
 PARTITION sr12018 VALUES LESS THAN (737149) ENGINE = InnoDB,
 PARTITION sr22018 VALUES LESS THAN (737240) ENGINE = InnoDB,
 PARTITION sr32018 VALUES LESS THAN (737332) ENGINE = InnoDB,
 PARTITION sr42018 VALUES LESS THAN (737424) ENGINE = InnoDB,
 PARTITION sr12019 VALUES LESS THAN (737514) ENGINE = InnoDB,
 PARTITION sr22019 VALUES LESS THAN (737605) ENGINE = InnoDB,
 PARTITION sr32019 VALUES LESS THAN (737697) ENGINE = InnoDB,
 PARTITION sr42019 VALUES LESS THAN (737789) ENGINE = InnoDB,
 PARTITION srfuture VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */;

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

--
-- Table structure for table `sales_ret_dtl`
--

CREATE TABLE IF NOT EXISTS `sales_ret_dtl` (
  `id` int(10) unsigned NOT NULL,
  `hdr_id` int(10) unsigned NOT NULL,
  `line_no` int(4) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `location_id` int(10) unsigned NOT NULL,
  `uom_id` int(10) unsigned NOT NULL,
  `uom_rate` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `price` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `list_price` decimal(14,6) DEFAULT '0.000000',
  `description` varchar(200) NOT NULL DEFAULT '',
  `shelf_id` int(10) unsigned NOT NULL DEFAULT '1',
  `batch_no` varchar(30) NOT NULL DEFAULT '',
  `serial_no` varchar(30) NOT NULL DEFAULT '',
  `stock_rotation_id` int(10) unsigned NOT NULL DEFAULT '1',
  `promotion_hdr_id` int(10) unsigned NOT NULL DEFAULT '0',
  `expiry_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `del_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `qty` decimal(14,4) NOT NULL DEFAULT '0.0000',
  `sent_qty` decimal(14,4) unsigned NOT NULL DEFAULT '0.0000',
  `disc_percent_01` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_02` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_03` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_04` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_05` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_06` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_07` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_08` decimal(7,4) DEFAULT '0.0000',
  `disc_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `disc_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `tax_group_id` int(10) unsigned NOT NULL,
  `tax_id_01` int(10) unsigned DEFAULT '0',
  `tax_percent_01` decimal(5,2) DEFAULT '0.00',
  `tax_id_02` int(10) unsigned DEFAULT '0',
  `tax_percent_02` decimal(5,2) DEFAULT '0.00',
  `tax_id_03` int(10) unsigned DEFAULT '0',
  `tax_percent_03` decimal(5,2) DEFAULT '0.00',
  `tax_id_04` int(10) unsigned DEFAULT '0',
  `tax_percent_04` decimal(5,2) DEFAULT '0.00',
  `tax_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `tax_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `order_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `order_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `remark` varchar(200) DEFAULT NULL,
  `is_closed` tinyint(1) NOT NULL DEFAULT '0',
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `userdate_01` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_02` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_03` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_04` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `reason_id` int(10) unsigned NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `sales_ret_dtl_c`
--

CREATE TABLE IF NOT EXISTS `sales_ret_dtl_c` (
  `id` int(10) unsigned NOT NULL,
  `sales_ret_hdr_id` int(10) unsigned NOT NULL,
  `hdr_id` int(10) unsigned NOT NULL,
  `line_no` int(4) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `location_id` int(10) unsigned NOT NULL,
  `uom_id` int(10) unsigned NOT NULL,
  `uom_rate` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `price` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `description` varchar(200) NOT NULL DEFAULT '',
  `shelf_id` int(10) unsigned NOT NULL DEFAULT '1',
  `batch_no` varchar(30) NOT NULL DEFAULT '',
  `serial_no` varchar(30) NOT NULL DEFAULT '',
  `stock_rotation_id` int(10) unsigned NOT NULL DEFAULT '1',
  `promotion_hdr_id` int(10) unsigned NOT NULL DEFAULT '0',
  `expiry_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `del_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `qty` decimal(14,4) NOT NULL DEFAULT '0.0000',
  `sent_qty` decimal(14,4) unsigned NOT NULL DEFAULT '0.0000',
  `disc_percent_01` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_02` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_03` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_04` decimal(7,4) DEFAULT '0.0000',
  `disc_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `disc_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `tax_group_id` int(10) unsigned NOT NULL,
  `tax_id_01` int(10) unsigned DEFAULT '0',
  `tax_percent_01` decimal(5,2) DEFAULT '0.00',
  `tax_id_02` int(10) unsigned DEFAULT '0',
  `tax_percent_02` decimal(5,2) DEFAULT '0.00',
  `tax_id_03` int(10) unsigned DEFAULT '0',
  `tax_percent_03` decimal(5,2) DEFAULT '0.00',
  `tax_id_04` int(10) unsigned DEFAULT '0',
  `tax_percent_04` decimal(5,2) DEFAULT '0.00',
  `tax_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `tax_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `order_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `order_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `remark` varchar(200) DEFAULT NULL,
  `is_closed` tinyint(1) NOT NULL DEFAULT '0',
  `reason_id` int(10) unsigned NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `sales_ret_hdr`
--

CREATE TABLE IF NOT EXISTS `sales_ret_hdr` (
  `id` int(10) unsigned NOT NULL,
  `doc_code` varchar(30) NOT NULL,
  `ref_code` varchar(30) NOT NULL DEFAULT '',
  `doc_date` datetime NOT NULL,
  `order_type` char(1) NOT NULL,
  `company_id` int(10) unsigned NOT NULL,
  `customer_id` int(10) unsigned NOT NULL,
  `salesman_id` int(10) unsigned NOT NULL,
  `project_id` int(10) unsigned NOT NULL DEFAULT '1',
  `division_id` int(10) unsigned NOT NULL,
  `term_id` int(10) unsigned NOT NULL,
  `term_code` varchar(20) NOT NULL,
  `term_day` int(5) NOT NULL,
  `branch_id` int(10) unsigned NOT NULL DEFAULT '0',
  `branch_code` varchar(20) DEFAULT '',
  `area_id` int(10) unsigned NOT NULL,
  `area_code` varchar(20) DEFAULT '',
  `del_address_01` varchar(100) NOT NULL DEFAULT '',
  `del_address_02` varchar(100) NOT NULL DEFAULT '',
  `del_address_03` varchar(100) NOT NULL DEFAULT '',
  `del_address_04` varchar(100) NOT NULL DEFAULT '',
  `del_attention` varchar(80) NOT NULL DEFAULT '',
  `del_postcode` varchar(10) NOT NULL DEFAULT '',
  `del_phone_01` varchar(30) NOT NULL DEFAULT '',
  `del_phone_02` varchar(30) NOT NULL DEFAULT '',
  `del_fax_01` varchar(30) NOT NULL DEFAULT '',
  `del_fax_02` varchar(30) NOT NULL DEFAULT '',
  `description` varchar(200) NOT NULL DEFAULT '',
  `currency_rate` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `currency_id` int(10) unsigned NOT NULL,
  `disc_percent_01` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_02` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_03` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_04` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_05` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_06` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_07` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_08` decimal(7,4) DEFAULT '0.0000',
  `disc_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `disc_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `tax_group_id` int(10) unsigned DEFAULT '0',
  `tax_id_01` int(10) unsigned DEFAULT '0',
  `tax_percent_01` decimal(5,2) DEFAULT '0.00',
  `tax_id_02` int(10) unsigned DEFAULT '0',
  `tax_percent_02` decimal(5,2) DEFAULT '0.00',
  `tax_id_03` int(10) unsigned DEFAULT '0',
  `tax_percent_03` decimal(5,2) DEFAULT '0.00',
  `tax_id_04` int(10) unsigned DEFAULT '0',
  `tax_percent_04` decimal(5,2) DEFAULT '0.00',
  `tax_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `tax_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `order_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `order_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `status` int(2) NOT NULL DEFAULT '0',
  `remark_01` varchar(200) DEFAULT NULL,
  `remark_02` varchar(200) DEFAULT NULL,
  `voided` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `voidedby` int(10) DEFAULT '0',
  `void_reason_id` int(10) DEFAULT '0',
  `void_remark` text,
  `location_check_in_id` int(10) unsigned NOT NULL DEFAULT '0',
  `is_printed` tinyint(1) NOT NULL DEFAULT '0',
  `is_exported` tinyint(1) NOT NULL DEFAULT '0',
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `userdate_01` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_02` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_03` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_04` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL,
  `shipment_code` varchar(30) NOT NULL DEFAULT '',
  `transport_code` varchar(30) NOT NULL DEFAULT '',
  `driver_name` varchar(30) NOT NULL DEFAULT '',
  `shipment_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `shipment_created` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `shipment_createdby` int(10) unsigned DEFAULT NULL,
  `shipment_seq` tinyint(3) NOT NULL DEFAULT '0',
  `shipment_remark` varchar(255) DEFAULT '',
  `is_shipment_printed` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `sales_ret_hdr_c`
--

CREATE TABLE IF NOT EXISTS `sales_ret_hdr_c` (
  `id` int(10) unsigned NOT NULL,
  `sales_ret_hdr_id` int(10) unsigned NOT NULL,
  `doc_code` varchar(30) NOT NULL,
  `ref_code` varchar(30) NOT NULL DEFAULT '',
  `doc_date` datetime NOT NULL,
  `order_type` char(1) NOT NULL,
  `company_id` int(10) unsigned NOT NULL,
  `customer_id` int(10) unsigned NOT NULL,
  `salesman_id` int(10) unsigned NOT NULL,
  `project_id` int(10) unsigned NOT NULL DEFAULT '1',
  `division_id` int(10) unsigned NOT NULL,
  `term_id` int(10) unsigned NOT NULL,
  `term_code` varchar(20) NOT NULL,
  `term_day` int(5) NOT NULL,
  `branch_id` int(10) unsigned NOT NULL DEFAULT '0',
  `branch_code` varchar(20) DEFAULT '',
  `area_id` int(10) unsigned NOT NULL,
  `area_code` varchar(20) NOT NULL,
  `del_address_01` varchar(100) NOT NULL DEFAULT '',
  `del_address_02` varchar(100) NOT NULL DEFAULT '',
  `del_address_03` varchar(100) NOT NULL DEFAULT '',
  `del_address_04` varchar(100) NOT NULL DEFAULT '',
  `del_attention` varchar(80) NOT NULL DEFAULT '',
  `del_postcode` varchar(10) NOT NULL DEFAULT '',
  `del_phone_01` varchar(30) NOT NULL DEFAULT '',
  `del_phone_02` varchar(30) NOT NULL DEFAULT '',
  `del_fax_01` varchar(30) NOT NULL DEFAULT '',
  `del_fax_02` varchar(30) NOT NULL DEFAULT '',
  `description` varchar(200) NOT NULL DEFAULT '',
  `currency_rate` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `currency_id` int(10) unsigned NOT NULL,
  `disc_percent_01` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_02` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_03` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_04` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_05` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_06` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_07` decimal(7,4) DEFAULT '0.0000',
  `disc_percent_08` decimal(7,4) DEFAULT '0.0000',
  `disc_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `disc_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `tax_group_id` int(10) unsigned DEFAULT '0',
  `tax_id_01` int(10) unsigned DEFAULT '0',
  `tax_percent_01` decimal(5,2) DEFAULT '0.00',
  `tax_id_02` int(10) unsigned DEFAULT '0',
  `tax_percent_02` decimal(5,2) DEFAULT '0.00',
  `tax_id_03` int(10) unsigned DEFAULT '0',
  `tax_percent_03` decimal(5,2) DEFAULT '0.00',
  `tax_id_04` int(10) unsigned DEFAULT '0',
  `tax_percent_04` decimal(5,2) DEFAULT '0.00',
  `tax_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `tax_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `order_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `order_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `status` int(2) NOT NULL DEFAULT '0',
  `remark_01` varchar(200) DEFAULT NULL,
  `remark_02` varchar(200) DEFAULT NULL,
  `location_check_in_id` int(10) unsigned NOT NULL DEFAULT '0',
  `is_printed` tinyint(1) NOT NULL DEFAULT '0',
  `is_exported` tinyint(1) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `sales_tracking`
--

CREATE TABLE IF NOT EXISTS `sales_tracking` (
  `id` int(10) unsigned NOT NULL,
  `customer_id` int(10) unsigned NOT NULL,
  `salesman_id` int(10) unsigned DEFAULT NULL,
  `sales_odr_hdr_id` int(10) unsigned DEFAULT NULL,
  `sales_odr_hdr_date` datetime DEFAULT NULL,
  `sales_odr_dtl_id` int(10) unsigned DEFAULT NULL,
  `sales_odr_dtl_date` datetime DEFAULT NULL,
  `do_inv_hdr_id` int(10) unsigned DEFAULT NULL,
  `do_inv_hdr_date` datetime DEFAULT NULL,
  `do_inv_dtl_id` int(10) unsigned DEFAULT NULL,
  `do_inv_dtl_date` datetime DEFAULT NULL,
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `shelf`
--

CREATE TABLE IF NOT EXISTS `shelf` (
  `id` int(10) unsigned NOT NULL,
  `location_id` int(10) unsigned NOT NULL,
  `code` varchar(15) NOT NULL,
  `description` varchar(60) NOT NULL DEFAULT '',
  `aisle_code` varchar(10) NOT NULL DEFAULT '',
  `bay_code` varchar(10) NOT NULL DEFAULT '',
  `level_code` varchar(10) NOT NULL DEFAULT '',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `shelf`
--

INSERT INTO `shelf` (`id`, `location_id`, `code`, `description`, `aisle_code`, `bay_code`, `level_code`, `created`, `createdby`, `updated`, `updatedby`) VALUES
(1, 0, '', '', '', '', '', '2012-02-19 19:27:08', 1, '2012-02-19 20:18:58', 1);

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

--
-- Table structure for table `shelf_aisle`
--

CREATE TABLE IF NOT EXISTS `shelf_aisle` (
  `id` int(10) unsigned NOT NULL,
  `code` varchar(10) NOT NULL,
  `description` varchar(60) NOT NULL DEFAULT '',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `shelf_aisle`
--

INSERT INTO `shelf_aisle` (`id`, `code`, `description`, `created`, `createdby`, `updated`, `updatedby`) VALUES
(1, 'A', 'A', '2012-02-19 19:27:08', 1, '2012-02-19 20:18:58', 1);

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

--
-- Table structure for table `shelf_bay`
--

CREATE TABLE IF NOT EXISTS `shelf_bay` (
  `id` int(10) unsigned NOT NULL,
  `code` varchar(10) NOT NULL,
  `description` varchar(60) NOT NULL DEFAULT '',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `shelf_bay`
--

INSERT INTO `shelf_bay` (`id`, `code`, `description`, `created`, `createdby`, `updated`, `updatedby`) VALUES
(1, '01', '01', '2012-02-19 19:27:08', 1, '2012-02-19 20:18:58', 1);

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

--
-- Table structure for table `shelf_level`
--

CREATE TABLE IF NOT EXISTS `shelf_level` (
  `id` int(10) unsigned NOT NULL,
  `code` varchar(10) NOT NULL,
  `description` varchar(60) NOT NULL DEFAULT '',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `shelf_level`
--

INSERT INTO `shelf_level` (`id`, `code`, `description`, `created`, `createdby`, `updated`, `updatedby`) VALUES
(1, '1', '01', '2012-02-19 19:27:08', 1, '2012-02-19 20:18:58', 1);

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

--
-- Table structure for table `stk_adj_dtl`
--

CREATE TABLE IF NOT EXISTS `stk_adj_dtl` (
  `id` int(10) unsigned NOT NULL,
  `hdr_id` int(10) unsigned NOT NULL,
  `line_no` int(5) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `location_id` int(10) unsigned NOT NULL,
  `description` varchar(200) DEFAULT NULL,
  `shelf_id` int(10) unsigned NOT NULL DEFAULT '1',
  `serial_no` varchar(30) NOT NULL DEFAULT '',
  `batch_no` varchar(30) NOT NULL DEFAULT '',
  `stock_rotation_id` int(10) unsigned NOT NULL DEFAULT '1',
  `expiry_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `price` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `sign` int(1) NOT NULL,
  `qty` decimal(20,4) NOT NULL DEFAULT '0.0000',
  `net_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `remark` varchar(200) DEFAULT NULL,
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `userdate_01` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_02` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_03` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_04` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `stk_adj_hdr`
--

CREATE TABLE IF NOT EXISTS `stk_adj_hdr` (
  `id` int(10) unsigned NOT NULL,
  `doc_code` varchar(30) NOT NULL,
  `ref_code` varchar(30) DEFAULT NULL,
  `doc_date` datetime NOT NULL,
  `company_id` int(10) unsigned NOT NULL,
  `storekeeper_id` int(10) unsigned NOT NULL,
  `division_id` int(10) unsigned NOT NULL,
  `reason_id` int(10) unsigned NOT NULL DEFAULT '0',
  `description` varchar(200) DEFAULT NULL,
  `currency_rate` decimal(14,6) NOT NULL DEFAULT '1.000000',
  `currency_id` int(10) unsigned NOT NULL,
  `net_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `stk_count_hdr_id` int(10) unsigned NOT NULL DEFAULT '0',
  `remark_01` varchar(200) DEFAULT NULL,
  `remark_02` varchar(200) DEFAULT NULL,
  `is_printed` tinyint(1) NOT NULL DEFAULT '0',
  `is_exported` tinyint(1) NOT NULL DEFAULT '0',
  `status` int(2) NOT NULL DEFAULT '0',
  `voided` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `voidedby` int(10) DEFAULT '0',
  `void_reason_id` int(10) DEFAULT '0',
  `void_remark` text,
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `userdate_01` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_02` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_03` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_04` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `stk_count_dtl`
--

CREATE TABLE IF NOT EXISTS `stk_count_dtl` (
  `id` int(10) unsigned NOT NULL,
  `hdr_id` int(10) unsigned NOT NULL,
  `line_no` int(5) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `location_id` int(10) unsigned NOT NULL,
  `uom_id` int(10) unsigned NOT NULL,
  `uom_rate` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `description` varchar(200) DEFAULT NULL,
  `shelf_id` int(10) unsigned NOT NULL DEFAULT '1',
  `serial_no` varchar(30) NOT NULL DEFAULT '',
  `batch_no` varchar(30) NOT NULL DEFAULT '',
  `stock_rotation_id` int(10) unsigned NOT NULL DEFAULT '1',
  `expiry_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `qty` decimal(20,4) NOT NULL DEFAULT '0.0000',
  `inventory_qty` decimal(14,4) NOT NULL DEFAULT '0.0000',
  `remark` varchar(200) DEFAULT NULL,
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL,
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `userdate_01` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_02` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_03` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_04` datetime NOT NULL DEFAULT '1970-01-01 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `stk_count_hdr`
--

CREATE TABLE IF NOT EXISTS `stk_count_hdr` (
  `id` int(10) unsigned NOT NULL,
  `doc_code` varchar(30) NOT NULL,
  `ref_code` varchar(30) DEFAULT NULL,
  `doc_date` datetime NOT NULL,
  `doc_type` char(1) NOT NULL,
  `company_id` int(10) unsigned NOT NULL,
  `storekeeper_id` int(10) unsigned NOT NULL,
  `division_id` int(10) unsigned NOT NULL,
  `description` varchar(200) DEFAULT NULL,
  `remark_01` varchar(200) DEFAULT NULL,
  `remark_02` varchar(200) DEFAULT NULL,
  `voided` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `voidedby` int(10) unsigned DEFAULT '0',
  `void_reason_id` int(10) DEFAULT '0',
  `void_remark` varchar(255) DEFAULT '',
  `is_printed` tinyint(1) NOT NULL DEFAULT '0',
  `is_exported` tinyint(1) NOT NULL DEFAULT '0',
  `status` int(2) NOT NULL DEFAULT '0',
  `recount` int(5) NOT NULL DEFAULT '0',
  `prev_hdr_id` int(10) unsigned NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL,
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `userdate_01` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_02` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_03` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_04` datetime NOT NULL DEFAULT '1970-01-01 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `stk_issue_dtl`
--

CREATE TABLE IF NOT EXISTS `stk_issue_dtl` (
  `id` int(10) unsigned NOT NULL,
  `hdr_id` int(10) unsigned NOT NULL,
  `line_no` int(4) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `description` varchar(200) DEFAULT NULL,
  `location_id` int(10) unsigned NOT NULL,
  `shelf_id` int(10) unsigned NOT NULL DEFAULT '1',
  `serial_no` varchar(30) NOT NULL DEFAULT '',
  `batch_no` varchar(30) NOT NULL DEFAULT '',
  `stock_rotation_id` int(10) unsigned NOT NULL DEFAULT '1',
  `expiry_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `uom_id` int(10) unsigned NOT NULL,
  `uom_rate` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `price` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `qty` decimal(14,4) NOT NULL DEFAULT '0.0000',
  `net_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `remark` varchar(200) DEFAULT NULL,
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `stk_issue_hdr`
--

CREATE TABLE IF NOT EXISTS `stk_issue_hdr` (
  `id` int(10) unsigned NOT NULL,
  `doc_code` varchar(30) NOT NULL,
  `ref_code` varchar(30) DEFAULT NULL,
  `doc_date` datetime NOT NULL,
  `company_id` int(10) unsigned NOT NULL,
  `storekeeper_id` int(10) unsigned NOT NULL,
  `division_id` int(10) unsigned NOT NULL,
  `reason_id` int(10) unsigned NOT NULL DEFAULT '0',
  `description` varchar(200) DEFAULT NULL,
  `currency_rate` decimal(14,6) NOT NULL DEFAULT '1.000000',
  `currency_id` int(10) unsigned NOT NULL,
  `net_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `is_printed` tinyint(1) NOT NULL DEFAULT '0',
  `is_exported` tinyint(1) NOT NULL DEFAULT '0',
  `status` int(2) NOT NULL DEFAULT '0',
  `remark_01` varchar(200) DEFAULT NULL,
  `remark_02` varchar(200) DEFAULT NULL,
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `stk_recv_dtl`
--

CREATE TABLE IF NOT EXISTS `stk_recv_dtl` (
  `id` int(10) unsigned NOT NULL,
  `hdr_id` int(10) unsigned NOT NULL,
  `line_no` int(4) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `location_id` int(10) unsigned NOT NULL,
  `description` varchar(200) DEFAULT NULL,
  `shelf_id` int(10) unsigned NOT NULL DEFAULT '1',
  `batch_no` varchar(30) DEFAULT NULL,
  `stock_rotation_id` int(10) unsigned NOT NULL DEFAULT '1',
  `expiry_date` datetime DEFAULT NULL,
  `uom_id` int(10) unsigned NOT NULL,
  `uom_rate` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `qty` decimal(14,4) NOT NULL DEFAULT '0.0000',
  `remark` varchar(200) DEFAULT NULL,
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `stk_recv_hdr`
--

CREATE TABLE IF NOT EXISTS `stk_recv_hdr` (
  `id` int(10) unsigned NOT NULL,
  `doc_code` varchar(30) NOT NULL,
  `ref_code` varchar(30) DEFAULT NULL,
  `doc_date` datetime NOT NULL,
  `company_id` int(10) unsigned NOT NULL,
  `storekeeper_id` int(10) unsigned NOT NULL,
  `division_id` int(10) unsigned NOT NULL,
  `reason_id` int(10) unsigned NOT NULL DEFAULT '0',
  `description` varchar(200) DEFAULT NULL,
  `currency_rate` decimal(14,6) NOT NULL DEFAULT '1.000000',
  `currency_id` int(10) unsigned NOT NULL,
  `net_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `remark_01` varchar(200) DEFAULT NULL,
  `remark_02` varchar(200) DEFAULT NULL,
  `is_printed` tinyint(1) NOT NULL DEFAULT '0',
  `status` int(2) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `stk_reserve_trans`
--

CREATE TABLE IF NOT EXISTS `stk_reserve_trans` (
  `id` int(10) unsigned NOT NULL,
  `post_date` datetime NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `item_code` varchar(30) NOT NULL,
  `uom_id` int(10) unsigned NOT NULL,
  `uom_rate` decimal(11,4) NOT NULL,
  `inventory_id` int(10) unsigned NOT NULL,
  `location_id` int(10) unsigned NOT NULL,
  `shelf_id` int(10) unsigned NOT NULL DEFAULT '1',
  `serial_no` varchar(30) DEFAULT NULL,
  `batch_no` varchar(30) DEFAULT NULL,
  `stock_rotation_id` int(10) unsigned NOT NULL DEFAULT '1',
  `expiry_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `company_id` int(10) unsigned NOT NULL,
  `doc_type` char(3) NOT NULL,
  `doc_id` int(10) unsigned NOT NULL,
  `doc_dtl_id` int(10) unsigned DEFAULT NULL,
  `doc_no` varchar(50) NOT NULL,
  `doc_date` datetime NOT NULL,
  `ref_no_01` varchar(50) DEFAULT NULL,
  `ref_no_02` varchar(50) DEFAULT NULL,
  `description` varchar(200) DEFAULT NULL,
  `sign` int(1) NOT NULL,
  `qty` decimal(20,4) DEFAULT NULL,
  `remark` varchar(200) DEFAULT NULL,
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `userdate_01` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_02` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_03` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_04` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `stk_trans`
--

CREATE TABLE IF NOT EXISTS `stk_trans` (
  `id` int(10) unsigned NOT NULL,
  `post_date` datetime NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `item_code` varchar(30) NOT NULL,
  `uom_id` int(10) unsigned NOT NULL,
  `uom_rate` decimal(11,4) NOT NULL,
  `uom_price` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `inventory_id` int(10) unsigned NOT NULL,
  `location_id` int(10) unsigned NOT NULL,
  `shelf_id` int(10) unsigned NOT NULL DEFAULT '1',
  `serial_no` varchar(30) DEFAULT NULL,
  `batch_no` varchar(30) DEFAULT NULL,
  `stock_rotation_id` int(10) unsigned NOT NULL DEFAULT '1',
  `expiry_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `company_id` int(10) unsigned NOT NULL,
  `doc_type` char(3) NOT NULL,
  `doc_id` int(10) unsigned NOT NULL,
  `doc_dtl_id` int(10) unsigned DEFAULT NULL,
  `doc_no` varchar(50) NOT NULL,
  `doc_date` datetime NOT NULL,
  `ref_no_01` varchar(50) DEFAULT NULL,
  `ref_no_02` varchar(50) DEFAULT NULL,
  `description` varchar(200) DEFAULT NULL,
  `sign` int(1) NOT NULL,
  `qty` decimal(20,4) NOT NULL DEFAULT '0.0000',
  `currency_id` int(10) unsigned NOT NULL,
  `cost` decimal(11,4) NOT NULL,
  `total_cost` decimal(11,4) NOT NULL,
  `stock_valuation_type` char(4) DEFAULT NULL,
  `account_id` int(10) unsigned NOT NULL,
  `net_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `remark` varchar(200) DEFAULT NULL,
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `userdate_01` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_02` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_03` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_04` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `stk_transfer_dtl`
--

CREATE TABLE IF NOT EXISTS `stk_transfer_dtl` (
  `id` int(10) unsigned NOT NULL,
  `hdr_id` int(10) unsigned NOT NULL,
  `line_no` int(4) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `description` varchar(200) DEFAULT NULL,
  `fr_location_id` int(10) unsigned NOT NULL,
  `fr_shelf_id` int(10) unsigned NOT NULL DEFAULT '1',
  `fr_serial_no` varchar(30) NOT NULL DEFAULT '',
  `fr_batch_no` varchar(30) NOT NULL DEFAULT '',
  `fr_stock_rotation_id` int(10) unsigned NOT NULL DEFAULT '1',
  `fr_expiry_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `to_location_id` int(10) unsigned NOT NULL,
  `to_shelf_id` int(10) unsigned NOT NULL DEFAULT '1',
  `price` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `qty` decimal(14,4) NOT NULL DEFAULT '0.0000',
  `net_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `remark` varchar(200) DEFAULT NULL,
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `userdate_01` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_02` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_03` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_04` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `stk_transfer_hdr`
--

CREATE TABLE IF NOT EXISTS `stk_transfer_hdr` (
  `id` int(10) unsigned NOT NULL,
  `doc_code` varchar(30) NOT NULL,
  `ref_code` varchar(30) DEFAULT NULL,
  `doc_date` datetime NOT NULL,
  `company_id` int(10) unsigned NOT NULL,
  `storekeeper_id` int(10) unsigned NOT NULL,
  `division_id` int(10) unsigned NOT NULL,
  `reason_id` int(10) unsigned NOT NULL DEFAULT '0',
  `description` varchar(200) DEFAULT NULL,
  `currency_rate` decimal(14,6) NOT NULL DEFAULT '1.000000',
  `currency_id` int(10) unsigned NOT NULL,
  `net_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `is_printed` tinyint(1) NOT NULL DEFAULT '0',
  `is_exported` tinyint(1) NOT NULL DEFAULT '0',
  `status` int(2) NOT NULL DEFAULT '0',
  `remark_01` varchar(200) DEFAULT NULL,
  `remark_02` varchar(200) DEFAULT NULL,
  `voided` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `voidedby` int(10) DEFAULT '0',
  `void_reason_id` int(10) DEFAULT '0',
  `void_remark` text,
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `userdate_01` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_02` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_03` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_04` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `stk_trans_purged`
--

CREATE TABLE IF NOT EXISTS `stk_trans_purged` (
  `id` int(10) unsigned NOT NULL,
  `post_date` datetime NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `item_code` varchar(30) NOT NULL,
  `uom_id` int(10) unsigned NOT NULL,
  `uom_rate` decimal(11,4) NOT NULL,
  `uom_price` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `inventory_id` int(10) unsigned NOT NULL,
  `location_id` int(10) unsigned NOT NULL,
  `shelf_id` int(10) unsigned NOT NULL DEFAULT '1',
  `serial_no` varchar(30) DEFAULT NULL,
  `batch_no` varchar(30) DEFAULT NULL,
  `stock_rotation_id` int(10) unsigned NOT NULL DEFAULT '1',
  `expiry_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `company_id` int(10) unsigned NOT NULL,
  `doc_type` char(3) NOT NULL,
  `doc_id` int(10) unsigned NOT NULL,
  `doc_dtl_id` int(10) unsigned DEFAULT NULL,
  `doc_no` varchar(50) NOT NULL,
  `doc_date` datetime NOT NULL,
  `ref_no_01` varchar(50) DEFAULT NULL,
  `ref_no_02` varchar(50) DEFAULT NULL,
  `description` varchar(200) DEFAULT NULL,
  `sign` int(1) NOT NULL,
  `qty` decimal(20,4) NOT NULL DEFAULT '0.0000',
  `currency_id` int(10) unsigned NOT NULL,
  `cost` decimal(11,4) NOT NULL,
  `total_cost` decimal(11,4) NOT NULL,
  `stock_valuation_type` char(4) DEFAULT NULL,
  `account_id` int(10) unsigned NOT NULL,
  `net_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `remark` varchar(200) DEFAULT NULL,
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `userdate_01` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_02` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_03` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_04` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `stock_rotation`
--

CREATE TABLE IF NOT EXISTS `stock_rotation` (
  `id` int(10) unsigned NOT NULL,
  `code` varchar(10) NOT NULL,
  `location_id` int(10) unsigned NOT NULL,
  `color_hex` varchar(10) NOT NULL DEFAULT 'ffffff',
  `start_date` datetime DEFAULT NULL,
  `rotate_mode` int(1) unsigned NOT NULL DEFAULT '2',
  `rotating_shift` int(4) unsigned NOT NULL DEFAULT '0',
  `sequence` int(4) unsigned NOT NULL DEFAULT '1',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `stock_rotation`
--

INSERT INTO `stock_rotation` (`id`, `code`, `location_id`, `color_hex`, `start_date`, `rotate_mode`, `rotating_shift`, `sequence`, `created`, `createdby`, `updated`, `updatedby`) VALUES
(1, '-', 0, 'ffffff', '1970-01-01 00:00:00', 0, 0, 1, '2012-02-19 19:27:08', 1, '2012-02-19 20:18:58', 1);

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

--
-- Table structure for table `system_settings`
--

CREATE TABLE IF NOT EXISTS `system_settings` (
  `id` int(10) unsigned NOT NULL,
  `code` varchar(20) NOT NULL,
  `description` varchar(60) DEFAULT NULL,
  `setting` varchar(255) DEFAULT '',
  `division_id` int(10) unsigned NOT NULL DEFAULT '0',
  `user_id` int(10) unsigned NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=95 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `system_settings`
--

INSERT INTO `system_settings` (`id`, `code`, `description`, `setting`, `division_id`, `user_id`, `created`, `createdby`, `updated`, `updatedby`) VALUES
(1, 'salesUseDO', 'Use Delivery order?', '1', 0, 0, '2012-02-19 19:27:08', 1, '2012-02-19 20:18:58', 1),
(2, 'salesCnUponReceive', 'Create sales return C/N upon receiving?', '0', 0, 0, '2012-02-19 19:27:08', 1, '2019-12-25 12:59:09', 1),
(3, 'salesDefaultSoDiv', 'Default division for S/O creation shortcut', '1', 0, 0, '2012-02-19 19:27:08', 1, '2012-02-19 20:18:58', 1),
(4, 'databaseVersion', 'Database current version', '136', 0, 0, '2012-02-19 19:27:08', 1, '2019-12-21 17:47:43', 1),
(5, 'salesRouteMode', 'Delivery Route Mode', '1', 0, 0, '2012-02-19 19:27:08', 1, '2012-02-19 20:18:58', 1),
(6, 'moVidUrl', 'Mobile User Guide Video URL', 'http://inverze.com/videos/', 0, 0, '2019-12-21 17:47:39', 1, '2019-12-21 17:47:39', 1),
(7, 'moVidUsername', 'Mobile User Guide Video Auth Username', 'video', 0, 0, '2019-12-21 17:47:39', 1, '2019-12-21 17:47:39', 1),
(8, 'moVidPassword', 'Mobile User Guide Video Auth Passwod', 'inv3rz3.com', 0, 0, '2019-12-21 17:47:39', 1, '2019-12-21 17:47:39', 1),
(9, 'salesOnCrdBlacklist', 'Enable Credit Blacklist', '0', 0, 0, '2019-12-25 12:59:09', 1, '2019-12-25 12:59:09', 1),
(10, 'salesRstBlklstTime', 'Reset Blacklist Time', '0', 0, 0, '2019-12-25 12:59:09', 1, '2019-12-25 12:59:09', 1),
(11, 'salesOrderHdrDelDate', 'Enable apply S/O line ETD', '0', 0, 0, '2019-12-25 12:59:09', 1, '2019-12-25 12:59:09', 1),
(12, 'salesSoPicking', 'Order picking mode', '0', 0, 0, '2019-12-25 12:59:09', 1, '2019-12-25 12:59:09', 1),
(13, 'salesLooseCaseQty', 'Loose/Case Quantity', '0', 0, 0, '2019-12-25 12:59:09', 1, '2019-12-25 12:59:09', 1),
(14, 'salesNonZeroStock', 'Block Negative Inventory', '0', 0, 0, '2019-12-25 12:59:09', 1, '2019-12-25 12:59:09', 1),
(15, 'salesDiscByAmt', 'Enable Discount by Amount', '0', 0, 0, '2019-12-25 12:59:09', 1, '2019-12-25 12:59:09', 1),
(16, 'printPickByItemGrp', 'Print Picking by Item Group', '0', 0, 0, '2019-12-25 12:59:09', 1, '2019-12-25 12:59:09', 1),
(17, 'salesDoConfirm', 'D/O Confirm Status', '3', 0, 0, '2019-12-25 12:59:09', 1, '2019-12-25 12:59:09', 1),
(18, 'salesCnCheckPrice', 'Enable Sales C/N price checking', '0', 0, 0, '2019-12-25 12:59:09', 1, '2019-12-25 12:59:09', 1),
(19, 'salesFreezePrice', 'Disable price change', '0', 0, 0, '2019-12-25 12:59:09', 1, '2019-12-25 12:59:09', 1),
(20, 'salesPriceDisc', 'Enable Disc Amt/UOM', '0', 0, 0, '2019-12-25 12:59:09', 1, '2019-12-25 12:59:09', 1),
(21, 'salesPickConfirmRow', 'Picking Selection Mode', '1', 0, 0, '2019-12-25 12:59:09', 1, '2019-12-25 12:59:09', 1),
(22, 'intgAgingDivCat', 'Aging Division Categorization', '1', 0, 0, '2019-12-25 12:59:09', 1, '2019-12-25 12:59:09', 1),
(23, 'printSoAsPickSumm', 'Print S/O As Picking Summary', '0', 0, 0, '2019-12-25 12:59:09', 1, '2019-12-25 12:59:09', 1),
(24, 'printSoAsPickPrev', 'Print S/O As Picking Preview', '0', 0, 0, '2019-12-25 12:59:09', 1, '2019-12-25 12:59:09', 1),
(25, 'pickSummRptFmt', 'Picking Summary Report Format', 'pdf', 0, 0, '2019-12-25 12:59:10', 1, '2019-12-25 12:59:10', 1),
(26, 'pickPrcChkMode', 'Picking Price Checking Mode', '0', 0, 0, '2019-12-25 12:59:10', 1, '2019-12-25 12:59:10', 1),
(27, 'salesDiscLevel', 'Discount % Level', '4', 0, 0, '2019-12-25 12:59:10', 1, '2019-12-25 12:59:10', 1),
(28, 'invoiceDateXDays', 'Invoice date at picking list, 1 = add 1 days from today date', '0', 0, 0, '2019-12-25 12:59:10', 1, '2019-12-25 12:59:10', 1),
(29, 'invoiceSkipDayWeek', 'Invoice skip day, 1 (for Monday) through 7 (for Sunday)', '0', 0, 0, '2019-12-25 12:59:10', 1, '2019-12-25 12:59:10', 1),
(30, 'vanSalesOrder', 'Van Sales Order', '0', 0, 0, '2019-12-25 12:59:10', 1, '2019-12-25 12:59:10', 1),
(31, 'vanInvNoMode', 'Van Sales Inv.No Mode', '0', 0, 0, '2019-12-25 12:59:10', 1, '2019-12-25 12:59:10', 1),
(32, 'vanInvDateMode', 'Van Sales Inv Date Mode', '0', 0, 0, '2019-12-25 12:59:10', 1, '2019-12-25 12:59:10', 1),
(33, 'salesRptGoodLoc', 'Good Location', 'GOOD', 0, 0, '2019-12-25 12:59:10', 1, '2019-12-25 12:59:10', 1),
(34, 'salesRptBadLoc', 'Bad Location', 'BAD', 0, 0, '2019-12-25 12:59:10', 1, '2019-12-25 12:59:10', 1),
(35, 'lockDocDate', 'Lock Document Date', '0', 0, 0, '2019-12-25 12:59:10', 1, '2019-12-25 12:59:10', 1),
(36, 'flowShowPrintSR', 'Show Print Sales Return', '0', 0, 0, '2019-12-25 12:59:10', 1, '2019-12-25 12:59:10', 1),
(37, 'confirmPrintInvCN', 'Confirmation before Print Inv. and C/N', '0', 0, 0, '2019-12-25 12:59:10', 1, '2019-12-25 12:59:10', 1),
(38, 'itemCBP', 'Show Item CBP', '0', 0, 0, '2019-12-25 12:59:10', 1, '2019-12-25 12:59:10', 1),
(39, 'returnPrice', 'Price cannot more than list price', '0', 0, 0, '2019-12-25 12:59:10', 1, '2019-12-25 12:59:10', 1),
(40, 'salesInvDtlSort', 'Invoice Details Sort By', 'item_brand.`code` ASC, item_code ASC', 0, 0, '2019-12-25 12:59:10', 1, '2019-12-25 12:59:10', 1),
(41, 'cashInvRounding', 'Cash Invoice Rounding', '0', 0, 0, '2019-12-25 12:59:10', 1, '2019-12-25 12:59:10', 1),
(42, 'moPriceAdjCode', 'Rounding Adj Item Code', '', 0, 0, '2019-12-25 12:59:10', 1, '2019-12-25 12:59:10', 1),
(43, 'pickShowWeight', 'Show Total Weight at Picking Page', '0', 0, 0, '2019-12-25 12:59:10', 1, '2019-12-25 12:59:10', 1),
(44, 'salesRptShowPnL', 'Show Sales P&L Report', '0', 0, 0, '2019-12-25 12:59:10', 1, '2019-12-25 12:59:10', 1),
(45, 'pickPrevAllByDiv', 'Picking Preview All By Division', '0', 0, 0, '2019-12-25 12:59:10', 1, '2019-12-25 12:59:10', 1),
(46, 'pickPrevAllMode', 'Picking Preview All Mode', '0', 0, 0, '2019-12-25 12:59:10', 1, '2019-12-25 12:59:10', 1),
(47, 'retagReverseSO', 'Retag Sales Order when Reverse?', '0', 0, 0, '2019-12-25 12:59:10', 1, '2019-12-25 12:59:10', 1),
(48, 'hideBelowCostMessage', 'Hide cost from Below Cost message?', '0', 0, 0, '2019-12-25 12:59:10', 1, '2019-12-25 12:59:10', 1),
(49, 'lockApprovedAmount', 'Lock Credit Approved Sales Order Amount?', '0', 0, 0, '2019-12-25 12:59:10', 1, '2019-12-25 12:59:10', 1),
(50, 'salesCshCrdDocNo', 'Cash document type will generate Cash Invoice Cd?', '0', 0, 0, '2019-12-25 12:59:10', 1, '2019-12-25 12:59:10', 1),
(51, 'shipmentMode', 'Shipment Mode', '3', 0, 0, '2019-12-25 12:59:10', 1, '2019-12-25 12:59:10', 1),
(52, 'enablePromoAllocTag', 'Enable S/O promotion allocation tagging', '0', 0, 0, '2019-12-25 12:59:10', 1, '2019-12-25 12:59:10', 1),
(53, 'shipmentRemarkLabel', 'Shipment Remark Label', 'Remarks,,,', 0, 0, '2019-12-25 12:59:10', 1, '2019-12-25 12:59:10', 1),
(54, 'soRunEnableSplit', 'Enable S/O (Outstanding) Split Order', '0', 0, 0, '2019-12-25 12:59:10', 1, '2019-12-25 12:59:10', 1),
(55, 'invRefDisable', 'Disable SR and CN Invoice Refer field UI.', '0', 0, 0, '2019-12-25 12:59:10', 1, '2019-12-25 12:59:10', 1),
(56, 'soInsertDiscCode', 'S/O Insert Discount Code', '', 0, 0, '2019-12-25 12:59:10', 1, '2019-12-25 12:59:10', 1),
(57, 'soRounding', 'Sales Order Rounding', '0', 0, 0, '2019-12-25 12:59:10', 1, '2019-12-25 12:59:10', 1),
(58, 'srRounding', 'Sales Return Rounding', '0', 0, 0, '2019-12-25 12:59:11', 1, '2019-12-25 12:59:11', 1),
(59, 'cnRounding', 'Credit Note Rounding', '0', 0, 0, '2019-12-25 12:59:11', 1, '2019-12-25 12:59:11', 1),
(60, 'creditInvRounding', 'Credit Invoice Rounding', '0', 0, 0, '2019-12-25 12:59:11', 1, '2019-12-25 12:59:11', 1),
(61, 'enableSoInvAmtAdj', 'S/O & Invoice Amount Adjustment', '0', 0, 0, '2019-12-25 12:59:11', 1, '2019-12-25 12:59:11', 1),
(62, 'mobilePicking', 'Mobile Picking', '0', 0, 0, '2019-12-25 12:59:11', 1, '2019-12-25 12:59:11', 1),
(63, 'mobilePacking', 'Mobile Packing', '0', 0, 0, '2019-12-25 12:59:11', 1, '2019-12-25 12:59:11', 1),
(64, 'salesMinimumPrice', 'Sales Minimum Price', '0', 0, 0, '2019-12-25 12:59:11', 1, '2019-12-25 12:59:11', 1),
(65, 'salesRequireTax', 'Sales Require Tax', '0', 0, 0, '2019-12-25 12:59:11', 1, '2019-12-25 12:59:11', 1),
(66, 'salesFixedTax', 'Fixed Sales Tax', '0', 0, 0, '2019-12-25 12:59:11', 1, '2019-12-25 12:59:11', 1),
(67, 'pickerMustSet', 'Must Set Picker in Picking Confirm', '0', 0, 0, '2019-12-25 12:59:11', 1, '2019-12-25 12:59:11', 1),
(68, 'soShowExported', 'Show exported status of S/O at SO Outstanding page', '0', 0, 0, '2019-12-25 12:59:11', 1, '2019-12-25 12:59:11', 1),
(69, 'soShowETDDate', 'Show ETD Date at Sales Order Header Page', '0', 0, 0, '2019-12-25 12:59:11', 1, '2019-12-25 12:59:11', 1),
(70, 'scpMode', 'Supply Chain Planning Mode', '0', 0, 0, '2019-12-25 12:59:11', 1, '2019-12-25 12:59:11', 1),
(71, 'moPickingSplit', 'Mobile Picking Split Loose - Case', '0', 0, 0, '2019-12-25 12:59:11', 1, '2019-12-25 12:59:11', 1),
(72, 'filterBySalesTeam', 'Agency Portal Filter Mode', '0', 0, 0, '2019-12-25 12:59:11', 1, '2019-12-25 12:59:11', 1),
(73, 'hidePurchaseReports', 'Agency Portal Hide Purchase Reports', '0', 0, 0, '2019-12-25 12:59:11', 1, '2019-12-25 12:59:11', 1),
(74, 'cusDefaultDivTerm', 'Customer terms default to DIVTERM', '0', 0, 0, '2019-12-25 12:59:11', 1, '2019-12-25 12:59:11', 1),
(75, 'soAllowCopyStatus', 'SO Allow Copy Status', '0', 0, 0, '2019-12-25 12:59:11', 1, '2019-12-25 12:59:11', 1),
(76, 'invRefGst', 'SR and CN Invoice Refer Mode', '0', 0, 0, '2019-12-25 12:59:11', 1, '2019-12-25 12:59:11', 1),
(77, 'soNonZeroStock', 'Block Negative Stock', '0', 1, 0, '2019-12-25 12:59:11', 1, '2019-12-25 12:59:11', 1),
(78, 'cusDivTermId', 'Customer Division Credit Terms', '1', 1, 0, '2019-12-25 12:59:11', 1, '2019-12-25 12:59:11', 1),
(79, 'listPriceColMode', 'List price column mode', '0', 0, 0, '2019-12-25 12:59:11', 1, '2019-12-25 12:59:11', 1),
(80, 'partDelReasonId', 'Partial Delivery Default Reason', '1', 0, 0, '2019-12-25 12:59:11', 1, '2019-12-25 12:59:11', 1),
(81, 'partDelAutoRea', 'Partial Delivery Auto Reason', '0', 0, 0, '2019-12-25 12:59:11', 1, '2019-12-25 12:59:11', 1),
(82, 'partDelAutoLoc', 'Partial Delivery Auto Location', '0', 0, 0, '2019-12-25 12:59:11', 1, '2019-12-25 12:59:11', 1),
(83, 'partDelConfStat', 'Partial Delivery Confirm to Document Status', '4', 0, 0, '2019-12-25 12:59:11', 1, '2019-12-25 12:59:11', 1),
(84, 'hideDelInfo', ' Hide Driver and Delivery Man at Assign Transport Barcode', '0', 0, 0, '2019-12-25 12:59:11', 1, '2019-12-25 12:59:11', 1),
(85, 'cnFollowRRDate', 'CN Date Follow Receiving Date', '0', 0, 0, '2019-12-25 12:59:11', 1, '2019-12-25 12:59:11', 1),
(86, 'soDefaultEDT', 'SO Default EDT Days', '5', 0, 0, '2019-12-25 12:59:11', 1, '2019-12-25 12:59:11', 1),
(87, 'showCustText02', 'Show Customer usertext_02 at Picking (For EBK)', '0', 0, 0, '2019-12-25 12:59:11', 1, '2019-12-25 12:59:11', 1),
(88, 'listPriceItemList', 'Product listing selling price column', '0', 0, 0, '2019-12-25 12:59:11', 1, '2019-12-25 12:59:11', 1),
(89, 'soOSShowEDT', 'SO Outstanding Page show EDT', '0', 0, 0, '2019-12-25 12:59:11', 1, '2019-12-25 12:59:11', 1),
(90, 'soLockDtlDesc', 'Lock item description', '0', 0, 0, '2019-12-25 12:59:11', 1, '2019-12-25 12:59:11', 1),
(91, 'doShowAmount', 'Show amount column', '0', 0, 0, '2019-12-25 12:59:12', 1, '2019-12-25 12:59:12', 1),
(92, 'soShowBalQtyCol', 'Show Bal.Qty Column', '0', 0, 0, '2019-12-25 12:59:12', 1, '2019-12-25 12:59:12', 1),
(93, 'itemDefaultLocation', 'Item Default Location', '0', 0, 0, '2019-12-25 12:59:12', 1, '2019-12-25 12:59:12', 1),
(94, 'priceGrpCusCat', 'Price Group Assign By', '0', 0, 0, '2019-12-25 12:59:12', 1, '2019-12-25 12:59:12', 1);

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

--
-- Table structure for table `target_collection`
--

CREATE TABLE IF NOT EXISTS `target_collection` (
  `id` int(10) unsigned NOT NULL,
  `user_id` int(11) NOT NULL DEFAULT '0',
  `target_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `target_date` datetime NOT NULL,
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `target_division`
--

CREATE TABLE IF NOT EXISTS `target_division` (
  `id` int(10) unsigned NOT NULL,
  `user_id` int(11) NOT NULL DEFAULT '0',
  `division_id` int(10) unsigned NOT NULL DEFAULT '0',
  `target_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `target_date` datetime NOT NULL,
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `target_item_group`
--

CREATE TABLE IF NOT EXISTS `target_item_group` (
  `id` int(10) unsigned NOT NULL,
  `user_id` int(11) NOT NULL DEFAULT '0',
  `item_group_id` int(10) unsigned NOT NULL DEFAULT '0',
  `item_group_01_id` int(10) unsigned NOT NULL DEFAULT '0',
  `item_group_02_id` int(10) unsigned NOT NULL DEFAULT '0',
  `target_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `target_date` datetime NOT NULL,
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `target_personal`
--

CREATE TABLE IF NOT EXISTS `target_personal` (
  `id` int(10) unsigned NOT NULL,
  `user_id` int(11) NOT NULL DEFAULT '0',
  `target_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `target_date` datetime NOT NULL,
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `tax`
--

CREATE TABLE IF NOT EXISTS `tax` (
  `id` int(10) unsigned NOT NULL,
  `tax_group_id` int(10) unsigned NOT NULL,
  `sequence` int(4) unsigned NOT NULL,
  `code` varchar(10) NOT NULL DEFAULT '',
  `description` varchar(255) DEFAULT NULL,
  `gl_account_tax` varchar(20) NOT NULL DEFAULT '',
  `non_taxable` tinyint(1) DEFAULT NULL,
  `tax_on_tax` tinyint(1) DEFAULT NULL,
  `rate` decimal(5,2) NOT NULL,
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `tax`
--

INSERT INTO `tax` (`id`, `tax_group_id`, `sequence`, `code`, `description`, `gl_account_tax`, `non_taxable`, `tax_on_tax`, `rate`, `userfield_01`, `userfield_02`, `userfield_03`, `userfield_04`, `usernumber_01`, `usernumber_02`, `usernumber_03`, `usernumber_04`, `useryesno_01`, `useryesno_02`, `useryesno_03`, `useryesno_04`, `created`, `createdby`, `updated`, `updatedby`) VALUES
(99, 99, 1, 'SR-0', 'STANDARD-RATED 0%', '', 0, NULL, '0.00', '', '', '', '', '0.0000', '0.0000', '0.0000', '0.0000', 0, 0, 0, 0, '2018-05-25 00:00:00', 1, '2018-05-25 00:00:00', 1),
(100, 100, 1, 'TX-0', 'PURCHASES WITH GST INCURRED 0%', '', 0, NULL, '0.00', '', '', '', '', '0.0000', '0.0000', '0.0000', '0.0000', 0, 0, 0, 0, '2018-05-25 00:00:00', 1, '2018-05-25 00:00:00', 1);

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

--
-- Table structure for table `tax_filing`
--

CREATE TABLE IF NOT EXISTS `tax_filing` (
  `id` int(10) unsigned NOT NULL,
  `filing_code` varchar(30) NOT NULL DEFAULT '',
  `company_id` int(10) unsigned NOT NULL,
  `start_date` datetime NOT NULL,
  `end_date` datetime NOT NULL,
  `submission_count` int(3) unsigned NOT NULL,
  `total_output` decimal(11,4) NOT NULL,
  `total_input` decimal(11,4) NOT NULL,
  `total_payable` decimal(11,4) NOT NULL,
  `total_claimable` decimal(11,4) NOT NULL,
  `status` int(2) NOT NULL DEFAULT '0',
  `locked_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `locked_by` int(10) unsigned NOT NULL DEFAULT '0',
  `remark_01` varchar(255) DEFAULT NULL,
  `remark_02` varchar(255) DEFAULT NULL,
  `gst03_exported` tinyint(1) NOT NULL DEFAULT '0',
  `gaf_exported` tinyint(1) NOT NULL DEFAULT '0',
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `tax_group`
--

CREATE TABLE IF NOT EXISTS `tax_group` (
  `id` int(10) unsigned NOT NULL,
  `code` varchar(10) NOT NULL,
  `description` varchar(255) DEFAULT NULL,
  `trans_type` char(3) NOT NULL,
  `inclusive` tinyint(1) DEFAULT NULL,
  `rate` decimal(5,2) NOT NULL,
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `tax_group`
--

INSERT INTO `tax_group` (`id`, `code`, `description`, `trans_type`, `inclusive`, `rate`, `userfield_01`, `userfield_02`, `userfield_03`, `userfield_04`, `usernumber_01`, `usernumber_02`, `usernumber_03`, `usernumber_04`, `useryesno_01`, `useryesno_02`, `useryesno_03`, `useryesno_04`, `created`, `createdby`, `updated`, `updatedby`) VALUES
(99, 'SR-0', 'STANDARD-RATED 0%', 's', 0, '0.00', '', '', '', '', '0.0000', '0.0000', '0.0000', '0.0000', 0, 0, 0, 0, '2018-05-25 00:00:00', 1, '2018-05-25 00:00:00', 1),
(100, 'TX-0', 'PURCHASES WITH GST INCURRED 0%', 'p', 0, '0.00', '', '', '', '', '0.0000', '0.0000', '0.0000', '0.0000', 0, 0, 0, 0, '2018-05-25 00:00:00', 1, '2018-05-25 00:00:00', 1),
(999, 'N/A', 'NOT APPLICABLE (DESIGNATED AREA)', 'x', 0, '0.00', '', '', '', '', '0.0000', '0.0000', '0.0000', '0.0000', 0, 0, 0, 0, '2014-12-29 23:36:42', 1, '2015-01-05 09:54:47', 1);

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

--
-- Table structure for table `tax_trans`
--

CREATE TABLE IF NOT EXISTS `tax_trans` (
  `id` int(10) unsigned NOT NULL,
  `post_date` datetime NOT NULL,
  `tax_filing_id` int(10) unsigned NOT NULL DEFAULT '0',
  `division_id` int(10) unsigned NOT NULL,
  `division_code` varchar(30) NOT NULL DEFAULT '',
  `company_id` int(10) unsigned NOT NULL,
  `company_code` varchar(30) NOT NULL DEFAULT '',
  `company_name` varchar(100) NOT NULL DEFAULT '',
  `tax_group_id` int(10) unsigned NOT NULL,
  `tax_group_code` varchar(20) NOT NULL DEFAULT '',
  `tax_group_desc` varchar(255) NOT NULL DEFAULT '',
  `tax_id` int(10) unsigned NOT NULL,
  `tax_code` varchar(20) NOT NULL DEFAULT '',
  `tax_desc` varchar(255) NOT NULL DEFAULT '',
  `tax_rate` decimal(5,2) NOT NULL,
  `gl_acc_code` varchar(20) NOT NULL DEFAULT '',
  `doc_type` char(3) NOT NULL,
  `doc_id` int(10) unsigned NOT NULL,
  `doc_no` varchar(50) NOT NULL DEFAULT '',
  `doc_date` datetime NOT NULL,
  `account_id` int(10) unsigned NOT NULL,
  `account_code` varchar(30) NOT NULL DEFAULT '',
  `account_name` varchar(150) NOT NULL DEFAULT '',
  `currency_id` int(10) unsigned NOT NULL,
  `currency_code` varchar(10) NOT NULL DEFAULT '',
  `currency_rate` decimal(11,4) NOT NULL,
  `dtl_id` int(10) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `item_code` varchar(50) NOT NULL DEFAULT '',
  `description` varchar(255) DEFAULT NULL,
  `reason_id` int(10) unsigned NOT NULL DEFAULT '0',
  `reason_code` varchar(30) NOT NULL DEFAULT '',
  `sign` int(1) NOT NULL,
  `taxable_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `taxable_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `tax_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `tax_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `net_local_amt` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `ref_code_01` varchar(30) NOT NULL DEFAULT '',
  `ref_code_02` varchar(30) NOT NULL DEFAULT '',
  `remark_01` varchar(255) DEFAULT NULL,
  `remark_02` varchar(255) DEFAULT NULL,
  `gst03_exported` tinyint(1) NOT NULL DEFAULT '0',
  `gaf_exported` tinyint(1) NOT NULL DEFAULT '0',
  `is_exported` tinyint(1) NOT NULL DEFAULT '0',
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `usernumber_02` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `usernumber_03` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `usernumber_04` decimal(14,6) NOT NULL DEFAULT '0.000000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `terms`
--

CREATE TABLE IF NOT EXISTS `terms` (
  `id` int(10) unsigned NOT NULL,
  `code` varchar(20) NOT NULL,
  `description` varchar(60) DEFAULT NULL,
  `type_id` int(10) unsigned NOT NULL,
  `period` int(2) DEFAULT NULL,
  `is_active` tinyint(1) DEFAULT NULL,
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=100000 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `terms`
--

INSERT INTO `terms` (`id`, `code`, `description`, `type_id`, `period`, `is_active`, `created`, `createdby`, `updated`, `updatedby`) VALUES
(1, 'COD', 'Cash on delivery', 5, 0, 1, '2012-02-18 18:37:41', 1, '2012-02-18 18:37:41', 1),
(2, '60DAYS', '60 Days', 3, 60, 1, '2012-02-18 18:37:10', 1, '2012-02-18 18:37:10', 1),
(3, '30DAYS', '30 Days', 3, 30, 1, '2012-02-18 18:33:34', 1, '2012-02-18 18:33:34', 1),
(99999, 'DIVTERM', 'Term Follow Division', 5, 0, 1, '2012-02-18 18:37:41', 1, '2012-02-18 18:37:41', 1);

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

--
-- Table structure for table `terms_type`
--

CREATE TABLE IF NOT EXISTS `terms_type` (
  `id` int(10) unsigned NOT NULL,
  `code` varchar(20) NOT NULL,
  `description` varchar(60) DEFAULT NULL,
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `terms_type`
--

INSERT INTO `terms_type` (`id`, `code`, `description`, `created`, `createdby`, `updated`, `updatedby`) VALUES
(1, 'MTHEND', 'Due in the month end', '1970-01-01 00:00:00', 1, '1970-01-01 00:00:00', 1),
(2, 'SPECDATE', 'Due on specific day of month', '1970-01-01 00:00:00', 1, '1970-01-01 00:00:00', 1),
(3, 'DAYS', 'Due in number of days', '1970-01-01 00:00:00', 1, '1970-01-01 00:00:00', 1),
(4, 'MONTHS', 'Due in number of months', '1970-01-01 00:00:00', 1, '1970-01-01 00:00:00', 1),
(5, 'C.O.D', 'Cash On Delivery', '1970-01-01 00:00:00', 1, '1970-01-01 00:00:00', 1),
(6, 'BTB1', '1 Credit Bill', '1970-01-01 00:00:00', 1, '1970-01-01 00:00:00', 1),
(7, 'BTB2', '2 Credit Bills', '1970-01-01 00:00:00', 1, '1970-01-01 00:00:00', 1),
(8, 'BTB3', '3 Credit Bills', '1970-01-01 00:00:00', 1, '1970-01-01 00:00:00', 1),
(9, 'TME+x Days', 'This Month End + x Days', '1970-01-01 00:00:00', 1, '1970-01-01 00:00:00', 1),
(10, 'NME+x Days', 'Next Month End + x Days', '1970-01-01 00:00:00', 1, '1970-01-01 00:00:00', 1),
(11, 'SME+x Days', 'Second Month End + x Days', '1970-01-01 00:00:00', 1, '1970-01-01 00:00:00', 1),
(12, 'NM+2 Payment', 'Next Month 2 Payment Window', '1970-01-01 00:00:00', 1, '1970-01-01 00:00:00', 1);

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

--
-- Table structure for table `transport`
--

CREATE TABLE IF NOT EXISTS `transport` (
  `id` int(10) unsigned NOT NULL,
  `code` varchar(30) NOT NULL,
  `description` varchar(100) NOT NULL DEFAULT '',
  `remark_01` varchar(255) DEFAULT NULL,
  `remark_02` varchar(255) DEFAULT NULL,
  `remark_03` varchar(255) DEFAULT NULL,
  `remark_04` varchar(255) DEFAULT NULL,
  `driver_name` varchar(100) NOT NULL DEFAULT '',
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `report_format_01` varchar(255) NOT NULL DEFAULT '',
  `report_format_02` varchar(255) NOT NULL DEFAULT '',
  `report_format_03` varchar(255) NOT NULL DEFAULT '',
  `report_format_04` varchar(255) NOT NULL DEFAULT '',
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL,
  `report_format_05` varchar(255) NOT NULL DEFAULT '',
  `report_format_06` varchar(255) NOT NULL DEFAULT '',
  `report_format_07` varchar(255) NOT NULL DEFAULT '',
  `report_format_08` varchar(255) NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `trial_balance`
--

CREATE TABLE IF NOT EXISTS `trial_balance` (
  `id` int(10) unsigned NOT NULL,
  `account_code` varchar(20) NOT NULL,
  `account_name` varchar(255) NOT NULL DEFAULT '',
  `sequence` int(4) unsigned NOT NULL,
  `cr_dr` char(1) NOT NULL,
  `sign` int(1) NOT NULL DEFAULT '1',
  `gl_type` char(1) NOT NULL,
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL,
  `company_id` int(10) unsigned NOT NULL DEFAULT '0',
  `mtd_debit` decimal(13,4) NOT NULL DEFAULT '0.0000',
  `mtd_credit` decimal(13,4) NOT NULL DEFAULT '0.0000',
  `ytd_debit` decimal(13,4) NOT NULL DEFAULT '0.0000',
  `ytd_credit` decimal(13,4) NOT NULL DEFAULT '0.0000'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `uom`
--

CREATE TABLE IF NOT EXISTS `uom` (
  `id` int(10) unsigned NOT NULL,
  `code` varchar(10) NOT NULL,
  `description` varchar(60) NOT NULL DEFAULT '',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `uom`
--

INSERT INTO `uom` (`id`, `code`, `description`, `created`, `createdby`, `updated`, `updatedby`) VALUES
(1, 'UNIT', 'UNIT', '1970-01-01 00:00:00', 1, '1970-01-01 00:00:00', 1),
(2, 'GRAM', 'GRAM', '1970-01-01 00:00:00', 1, '1970-01-01 00:00:00', 1),
(3, 'METER', 'METER', '1970-01-01 00:00:00', 1, '1970-01-01 00:00:00', 1);

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

--
-- Table structure for table `user_customer`
--

CREATE TABLE IF NOT EXISTS `user_customer` (
  `id` int(10) unsigned NOT NULL,
  `user_id` int(10) unsigned NOT NULL,
  `customer_id` int(10) unsigned NOT NULL,
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `user_division`
--

CREATE TABLE IF NOT EXISTS `user_division` (
  `id` int(10) unsigned NOT NULL,
  `user_id` int(10) unsigned NOT NULL,
  `division_id` int(10) unsigned NOT NULL,
  `username` varchar(20) DEFAULT '',
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `user_division`
--

INSERT INTO `user_division` (`id`, `user_id`, `division_id`, `username`, `userfield_01`, `userfield_02`, `usernumber_01`, `usernumber_02`, `useryesno_01`, `useryesno_02`, `created`, `createdby`, `updated`, `updatedby`) VALUES
(1, 1, 1, '', '', '', '0.0000', '0.0000', 0, 0, '2012-02-20 21:06:31', 1, '2012-02-20 21:06:31', 1);

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

--
-- Table structure for table `user_exclude_item_group`
--

CREATE TABLE IF NOT EXISTS `user_exclude_item_group` (
  `id` int(10) unsigned NOT NULL,
  `user_id` int(10) unsigned NOT NULL,
  `item_group_id` int(10) unsigned NOT NULL DEFAULT '0',
  `item_group_01_id` int(10) unsigned NOT NULL DEFAULT '0',
  `item_group_02_id` int(10) unsigned NOT NULL DEFAULT '0',
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `user_image`
--

CREATE TABLE IF NOT EXISTS `user_image` (
  `id` int(10) unsigned NOT NULL,
  `user_id` int(10) unsigned NOT NULL,
  `remark` varchar(200) DEFAULT NULL,
  `thumbnail` mediumblob,
  `picture` mediumblob,
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `userdate_01` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_02` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_03` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_04` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `user_item`
--

CREATE TABLE IF NOT EXISTS `user_item` (
  `id` int(10) unsigned NOT NULL,
  `user_id` int(10) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `user_item_group`
--

CREATE TABLE IF NOT EXISTS `user_item_group` (
  `id` int(10) unsigned NOT NULL,
  `user_id` int(10) unsigned NOT NULL,
  `item_group_id` int(10) unsigned NOT NULL DEFAULT '0',
  `item_group_01_id` int(10) unsigned NOT NULL DEFAULT '0',
  `item_group_02_id` int(10) unsigned NOT NULL DEFAULT '0',
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `user_profiles`
--

CREATE TABLE IF NOT EXISTS `user_profiles` (
  `id` int(11) NOT NULL,
  `lastname` varchar(50) NOT NULL DEFAULT '',
  `firstname` varchar(50) NOT NULL DEFAULT '',
  `is_lite_user` tinyint(1) DEFAULT '0',
  `is_wnd_person` tinyint(1) DEFAULT '0',
  `is_agency_pic` tinyint(1) DEFAULT '0',
  `is_salesman` tinyint(1) DEFAULT '0',
  `is_retailer` tinyint(1) DEFAULT '0',
  `phone` varchar(50) DEFAULT NULL,
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL,
  `is_supplier` tinyint(1) DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `user_profiles`
--

INSERT INTO `user_profiles` (`id`, `lastname`, `firstname`, `is_lite_user`, `is_wnd_person`, `is_agency_pic`, `is_salesman`, `is_retailer`, `phone`, `created`, `createdby`, `updated`, `updatedby`, `is_supplier`) VALUES
(1, 'Admin', 'Administrator', 0, 0, 0, 0, 0, '', '2012-02-20 21:06:31', 1, '2012-02-20 21:06:31', 1, 0);

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

--
-- Table structure for table `user_profiles_fields`
--

CREATE TABLE IF NOT EXISTS `user_profiles_fields` (
  `id` int(10) NOT NULL,
  `varname` varchar(50) NOT NULL,
  `title` varchar(255) NOT NULL,
  `field_type` varchar(50) NOT NULL,
  `field_size` int(3) NOT NULL DEFAULT '0',
  `field_size_min` int(3) NOT NULL DEFAULT '0',
  `required` int(1) NOT NULL DEFAULT '0',
  `match` varchar(255) NOT NULL DEFAULT '',
  `range` varchar(255) NOT NULL DEFAULT '',
  `error_message` varchar(255) NOT NULL DEFAULT '',
  `other_validator` varchar(5000) NOT NULL DEFAULT '',
  `default` varchar(255) NOT NULL DEFAULT '',
  `widget` varchar(255) NOT NULL DEFAULT '',
  `widgetparams` varchar(5000) NOT NULL DEFAULT '',
  `position` int(3) NOT NULL DEFAULT '0',
  `visible` int(1) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `user_profiles_fields`
--

INSERT INTO `user_profiles_fields` (`id`, `varname`, `title`, `field_type`, `field_size`, `field_size_min`, `required`, `match`, `range`, `error_message`, `other_validator`, `default`, `widget`, `widgetparams`, `position`, `visible`, `created`, `createdby`, `updated`, `updatedby`) VALUES
(1, 'lastname', 'Last Name', 'VARCHAR', 50, 1, 1, '', '', 'Incorrect Last Name (length between 3 and 50 characters).', '', '', '', '', 1, 3, '2012-02-20 21:06:31', 1, '2012-02-20 21:06:31', 1),
(2, 'firstname', 'First Name', 'VARCHAR', 50, 1, 1, '', '', 'Incorrect First Name (length between 3 and 50 characters).', '', '', '', '', 0, 3, '2012-02-20 21:06:31', 1, '2012-02-20 21:06:31', 1),
(3, 'is_salesman', 'Is Salesman', 'INTEGER', 1, 1, 2, '', '', '', '', '', '', '', 2, 3, '2012-02-20 21:06:31', 1, '2012-02-20 21:06:31', 1),
(4, 'phone', 'Phone', 'VARCHAR', 50, 1, 2, '', '', '', '', '', '', '', 3, 3, '2012-02-20 21:06:31', 1, '2012-02-20 21:06:31', 1),
(5, 'is_agency_pic', 'Agency PIC', 'INTEGER', 1, 1, 2, '', '', '', '', '', '', '', 5, 3, '2014-05-20 00:00:00', 1, '2014-05-20 00:00:00', 1),
(6, 'is_wnd_person', 'W and D Person', 'INTEGER', 1, 1, 2, '', '', '', '', '', '', '', 5, 3, '2014-05-20 00:00:00', 1, '2014-05-20 00:00:00', 1),
(7, 'is_retailer', 'Retailer', 'INTEGER', 1, 1, 2, '', '', '', '', '', '', '', 7, 3, '2014-05-20 00:00:00', 1, '2014-05-20 00:00:00', 1),
(8, 'is_supplier', 'Supplier', 'INTEGER', 1, 1, 2, '', '', '', '', '', '', '', 8, 3, '2014-05-20 00:00:00', 1, '2014-05-20 00:00:00', 1),
(9, 'is_lite_user', 'Lite User', 'INTEGER', 1, 1, 2, '', '', '', '', '', '', '', 10, 3, '2014-05-20 00:00:00', 1, '2014-05-20 00:00:00', 1);

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

--
-- Table structure for table `user_vendor`
--

CREATE TABLE IF NOT EXISTS `user_vendor` (
  `id` int(10) unsigned NOT NULL,
  `user_id` int(10) unsigned NOT NULL,
  `vendor_id` int(10) unsigned NOT NULL,
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `userfield_04` varchar(255) NOT NULL DEFAULT '',
  `userfield_05` varchar(255) NOT NULL DEFAULT '',
  `userfield_06` varchar(255) NOT NULL DEFAULT '',
  `userfield_07` varchar(255) NOT NULL DEFAULT '',
  `userfield_08` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_05` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_06` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_07` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_08` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_04` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_05` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_06` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_07` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_08` tinyint(1) NOT NULL DEFAULT '0',
  `userdate_01` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_02` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_03` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_04` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_05` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_06` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_07` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `userdate_08` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `van_sales_settings`
--

CREATE TABLE IF NOT EXISTS `van_sales_settings` (
  `id` int(10) unsigned NOT NULL,
  `code` varchar(30) NOT NULL,
  `description` varchar(60) DEFAULT NULL,
  `setting` text,
  `division_id` int(10) unsigned NOT NULL DEFAULT '0',
  `user_id` int(10) unsigned NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `vendor`
--

CREATE TABLE IF NOT EXISTS `vendor` (
  `id` int(10) unsigned NOT NULL,
  `code` varchar(15) NOT NULL,
  `ref_code` varchar(30) DEFAULT NULL,
  `company_name` varchar(100) NOT NULL,
  `company_name_01` varchar(100) DEFAULT NULL,
  `category_id` int(10) unsigned NOT NULL,
  `area_id` int(10) unsigned NOT NULL,
  `agent_id` int(10) unsigned DEFAULT NULL,
  `term_id` int(10) unsigned NOT NULL,
  `currency_id` int(10) unsigned NOT NULL,
  `sales_tax_id` int(10) unsigned NOT NULL DEFAULT '0',
  `purchase_tax_id` int(10) unsigned NOT NULL DEFAULT '0',
  `registration_no` varchar(50) NOT NULL DEFAULT '',
  `gst_reg_no` varchar(50) NOT NULL DEFAULT '',
  `business_nature` varchar(200) NOT NULL DEFAULT '',
  `address_01` varchar(100) NOT NULL,
  `address_02` varchar(100) NOT NULL DEFAULT '',
  `address_03` varchar(100) NOT NULL DEFAULT '',
  `address_04` varchar(100) NOT NULL DEFAULT '',
  `attention` varchar(80) NOT NULL DEFAULT '',
  `postcode` varchar(10) NOT NULL DEFAULT '',
  `phone_01` varchar(30) NOT NULL DEFAULT '',
  `phone_02` varchar(30) NOT NULL DEFAULT '',
  `fax_01` varchar(30) NOT NULL DEFAULT '',
  `fax_02` varchar(30) NOT NULL DEFAULT '',
  `email` varchar(60) NOT NULL DEFAULT '',
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `tax_exempt_no` varchar(50) NOT NULL DEFAULT '',
  `tax_exp_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
  `website` varchar(50) NOT NULL DEFAULT '',
  `allow_exceed_credit_limit` tinyint(1) NOT NULL DEFAULT '0',
  `overdue_limit` decimal(11,4) unsigned NOT NULL DEFAULT '0.0000',
  `credit_limit` decimal(11,4) unsigned NOT NULL DEFAULT '0.0000',
  `logo` mediumblob,
  `remark` varchar(200) NOT NULL DEFAULT '',
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `userfield_03` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_03` tinyint(1) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `vendor_branch`
--

CREATE TABLE IF NOT EXISTS `vendor_branch` (
  `id` int(10) unsigned NOT NULL,
  `vendor_id` int(10) unsigned NOT NULL,
  `name` varchar(100) NOT NULL,
  `code` varchar(21) NOT NULL,
  `area_id` int(10) unsigned NOT NULL,
  `address_01` varchar(100) NOT NULL,
  `address_02` varchar(100) NOT NULL DEFAULT '',
  `address_03` varchar(100) NOT NULL DEFAULT '',
  `address_04` varchar(100) NOT NULL DEFAULT '',
  `postcode` varchar(10) NOT NULL DEFAULT '',
  `attention` varchar(80) NOT NULL DEFAULT '',
  `phone_01` varchar(30) NOT NULL DEFAULT '',
  `phone_02` varchar(30) NOT NULL DEFAULT '',
  `fax_01` varchar(30) NOT NULL DEFAULT '',
  `fax_02` varchar(30) NOT NULL DEFAULT '',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `vendor_category`
--

CREATE TABLE IF NOT EXISTS `vendor_category` (
  `id` int(10) unsigned NOT NULL,
  `code` varchar(10) NOT NULL,
  `description` varchar(60) NOT NULL DEFAULT '',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `vendor_category`
--

INSERT INTO `vendor_category` (`id`, `code`, `description`, `created`, `createdby`, `updated`, `updatedby`) VALUES
(1, '-', '-', '2012-01-01 01:01:00', 1, '2012-01-01 01:01:00', 1);

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

--
-- Table structure for table `vendor_contact`
--

CREATE TABLE IF NOT EXISTS `vendor_contact` (
  `id` int(10) unsigned NOT NULL,
  `vendor_id` int(10) unsigned NOT NULL,
  `name` varchar(100) NOT NULL,
  `department` varchar(60) NOT NULL DEFAULT '',
  `title` varchar(60) NOT NULL DEFAULT '',
  `mobile_phone` varchar(30) NOT NULL DEFAULT '',
  `direct_phone` varchar(30) NOT NULL DEFAULT '',
  `direct_fax` varchar(30) NOT NULL DEFAULT '',
  `email` varchar(60) NOT NULL DEFAULT '',
  `im` varchar(60) NOT NULL DEFAULT '',
  `remark` varchar(200) NOT NULL DEFAULT '',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `vendor_division`
--

CREATE TABLE IF NOT EXISTS `vendor_division` (
  `id` int(10) unsigned NOT NULL,
  `vendor_id` int(10) unsigned NOT NULL,
  `division_id` int(10) unsigned NOT NULL,
  `price_group_id` int(10) NOT NULL DEFAULT '0',
  `gl_account_sales` varchar(20) NOT NULL DEFAULT '',
  `gl_account_salesreturn` varchar(20) NOT NULL DEFAULT '',
  `gl_account_cashsales` varchar(20) NOT NULL DEFAULT '',
  `gl_account_purchase` varchar(20) NOT NULL DEFAULT '',
  `gl_account_cashpurchase` varchar(20) NOT NULL DEFAULT '',
  `gl_account_purchasereturn` varchar(20) NOT NULL DEFAULT '',
  `userfield_01` varchar(255) NOT NULL DEFAULT '',
  `userfield_02` varchar(255) NOT NULL DEFAULT '',
  `usernumber_01` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `useryesno_01` tinyint(1) NOT NULL DEFAULT '0',
  `useryesno_02` tinyint(1) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `vendor_ob`
--

CREATE TABLE IF NOT EXISTS `vendor_ob` (
  `id` int(10) unsigned NOT NULL,
  `vendor_id` int(10) unsigned NOT NULL,
  `vendor_code` varchar(30) NOT NULL,
  `ob_amt` decimal(11,4) unsigned NOT NULL DEFAULT '0.0000',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `visit_dtl`
--

CREATE TABLE IF NOT EXISTS `visit_dtl` (
  `id` int(10) unsigned NOT NULL,
  `hdr_id` int(10) unsigned NOT NULL,
  `line_no` int(4) unsigned NOT NULL,
  `description` varchar(255) NOT NULL DEFAULT '',
  `pic_01` varchar(100) DEFAULT '',
  `pic_02` varchar(100) DEFAULT '',
  `pic_03` varchar(100) DEFAULT '',
  `pic_04` varchar(100) DEFAULT '',
  `content_01` text,
  `content_02` text,
  `content_03` text,
  `content_04` text,
  `photo_01` mediumblob,
  `photo_02` mediumblob,
  `photo_03` mediumblob,
  `photo_04` mediumblob,
  `userfield_01` varchar(255) DEFAULT '',
  `userfield_02` varchar(255) DEFAULT '',
  `userfield_03` varchar(255) DEFAULT '',
  `userfield_04` varchar(255) DEFAULT '',
  `usernumber_01` decimal(11,4) DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) DEFAULT '0.0000',
  `useryesno_01` tinyint(1) DEFAULT '0',
  `useryesno_02` tinyint(1) DEFAULT '0',
  `useryesno_03` tinyint(1) DEFAULT '0',
  `useryesno_04` tinyint(1) DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `visit_hdr`
--

CREATE TABLE IF NOT EXISTS `visit_hdr` (
  `id` int(10) unsigned NOT NULL,
  `visit_type` varchar(100) NOT NULL DEFAULT '',
  `division_id` int(10) unsigned NOT NULL,
  `customer_id` int(10) unsigned NOT NULL,
  `branch_id` int(10) unsigned NOT NULL DEFAULT '0',
  `branch_code` varchar(20) DEFAULT '',
  `area_id` int(10) unsigned NOT NULL,
  `area_code` varchar(20) DEFAULT '',
  `salesman_id` int(10) unsigned NOT NULL,
  `location_check_in_id` int(10) unsigned NOT NULL DEFAULT '0',
  `start_date` datetime NOT NULL,
  `end_date` datetime NOT NULL,
  `description` varchar(255) NOT NULL DEFAULT '',
  `status` tinyint(1) NOT NULL DEFAULT '1',
  `ref_no_01` varchar(30) NOT NULL DEFAULT '',
  `ref_no_02` varchar(30) NOT NULL DEFAULT '',
  `note_01` text,
  `note_02` text,
  `note_03` text,
  `note_04` text,
  `remark_01` varchar(255) NOT NULL DEFAULT '',
  `remark_02` varchar(255) NOT NULL DEFAULT '',
  `remark_03` varchar(255) NOT NULL DEFAULT '',
  `remark_04` varchar(255) NOT NULL DEFAULT '',
  `userfield_01` varchar(255) DEFAULT '',
  `userfield_02` varchar(255) DEFAULT '',
  `userfield_03` varchar(255) DEFAULT '',
  `userfield_04` varchar(255) DEFAULT '',
  `usernumber_01` decimal(11,4) DEFAULT '0.0000',
  `usernumber_02` decimal(11,4) DEFAULT '0.0000',
  `usernumber_03` decimal(11,4) DEFAULT '0.0000',
  `usernumber_04` decimal(11,4) DEFAULT '0.0000',
  `useryesno_01` tinyint(1) DEFAULT '0',
  `useryesno_02` tinyint(1) DEFAULT '0',
  `useryesno_03` tinyint(1) DEFAULT '0',
  `useryesno_04` tinyint(1) DEFAULT '0',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL,
  `visit_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `wnd_user`
--

CREATE TABLE IF NOT EXISTS `wnd_user` (
  `id` int(10) unsigned NOT NULL,
  `username` varchar(20) NOT NULL,
  `lastname` varchar(50) NOT NULL DEFAULT '',
  `firstname` varchar(50) NOT NULL DEFAULT '',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `workflow_node`
--

CREATE TABLE IF NOT EXISTS `workflow_node` (
  `id` int(10) unsigned NOT NULL,
  `division_id` int(10) unsigned NOT NULL DEFAULT '0',
  `description` varchar(200) NOT NULL DEFAULT '',
  `controller_name` varchar(40) NOT NULL,
  `action_name` varchar(40) NOT NULL,
  `sequence` int(4) unsigned NOT NULL DEFAULT '1',
  `color_hex` varchar(10) NOT NULL DEFAULT 'ffffff',
  `tag_label` varchar(20) NOT NULL DEFAULT '',
  `tag_message` varchar(200) NOT NULL DEFAULT '',
  `node_action` int(2) unsigned NOT NULL DEFAULT '1',
  `attention_required` int(1) unsigned NOT NULL DEFAULT '1',
  `created` datetime NOT NULL,
  `createdby` int(10) unsigned NOT NULL,
  `updated` datetime NOT NULL,
  `updatedby` int(10) unsigned NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `workflow_node`
--

INSERT INTO `workflow_node` (`id`, `division_id`, `description`, `controller_name`, `action_name`, `sequence`, `color_hex`, `tag_label`, `tag_message`, `node_action`, `attention_required`, `created`, `createdby`, `updated`, `updatedby`) VALUES
(1, 0, 'Customer Blacklist', 'SalesOdrHdrController', 'processCustomerBlacklist', 2, '808080', 'Blacklist', 'Customer Blacklist', 2, 0, '2012-01-01 00:00:00', 1, '2012-01-01 00:00:00', 1),
(2, 0, 'Division Credit Limit', 'SalesOdrHdrController', 'processDivisionCreditLimit', 3, '800080', 'Division Credit Limi', 'Customer Credit Limit', 2, 0, '2012-01-01 00:00:00', 1, '2012-01-01 00:00:00', 1),
(3, 0, 'Group Credit Limit', 'SalesOdrHdrController', 'processGroupCreditLimit', 4, '0000ff', 'Group Credit Limit', 'Customer Credit Limit', 2, 0, '2012-01-01 00:00:00', 1, '2012-01-01 00:00:00', 1),
(4, 0, 'Promotion & Discount', 'SalesOdrHdrController', 'processPromotionNDiscount', 5, 'ff0000', 'Promotion & Discount', 'Promotion & Discount', 2, 0, '2012-01-01 00:00:00', 1, '2012-01-01 00:00:00', 1),
(5, 0, 'Pricing', 'SalesOdrHdrController', 'processPricing', 6, '00ff00', 'Pricing', 'Pricing', 1, 0, '2012-01-01 00:00:00', 1, '2012-01-01 00:00:00', 1),
(6, 0, 'Stock Allocation', 'SalesOdrHdrController', 'processStockAllocation', 99, 'ffff00', 'Stock Allocation', 'Stock Allocation', 1, 0, '2012-01-01 00:00:00', 1, '2012-01-01 00:00:00', 1),
(7, 0, 'Final Approval', 'SalesOdrHdrController', 'processFinalApproval', 1, '00ffff', 'Final Approval', 'Final Approval', 2, 1, '2012-01-01 00:00:00', 1, '2012-01-01 00:00:00', 1),
(8, 0, 'Minimum Price', 'SalesOdrHdrController', 'processMinimumPrice', 7, '06795A', 'Minimum Price', 'Minimum Price', 1, 1, '2012-01-01 00:00:00', 1, '2012-01-01 00:00:00', 1);

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

--
-- Table structure for table `z_debtor_aging`
--

CREATE TABLE IF NOT EXISTS `z_debtor_aging` (
  `id` int(10) unsigned NOT NULL,
  `debtor_trans_id` int(10) unsigned NOT NULL DEFAULT '0',
  `salesman_id` int(10) unsigned NOT NULL DEFAULT '0',
  `customer_id` int(10) unsigned NOT NULL DEFAULT '0',
  `doc_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `local_amt` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `postdate_amt` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `draft_amt` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `paid_amt` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `mtd_colletion_amt` decimal(11,4) NOT NULL DEFAULT '0.0000',
  `report_id` varchar(100) NOT NULL DEFAULT '',
  `report_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `createdby` int(10) unsigned NOT NULL DEFAULT '0',
  `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `division_id` int(10) unsigned NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Structure for view `item_uom_stat`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `item_uom_stat` AS select `item_uom`.`item_id` AS `item_id`,max(`item_uom`.`uom_rate`) AS `max_rate`,min(`item_uom`.`uom_rate`) AS `min_rate` from `item_uom` group by `item_uom`.`item_id`;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `area`
--
ALTER TABLE `area`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `audit_trail`
--
ALTER TABLE `audit_trail`
  ADD PRIMARY KEY (`id`);

ALTER TABLE `audit_trail` ADD INDEX `audit_trail_idx` (`model`, `model_id`, `field`, `action`) ;

--
-- Indexes for table `authassignment`
--
ALTER TABLE `authassignment`
  ADD PRIMARY KEY (`itemname`,`userid`),
  ADD KEY `auth_userid` (`userid`);

--
-- Indexes for table `authitem`
--
ALTER TABLE `authitem`
  ADD PRIMARY KEY (`name`);

--
-- Indexes for table `authitemchild`
--
ALTER TABLE `authitemchild`
  ADD PRIMARY KEY (`parent`,`child`),
  ADD KEY `child` (`child`);

--
-- Indexes for table `barcode`
--
ALTER TABLE `barcode`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `call_card_dtl`
--
ALTER TABLE `call_card_dtl`
  ADD PRIMARY KEY (`id`),
  ADD KEY `call_card_dtl_hdr_id` (`hdr_id`);

--
-- Indexes for table `call_card_dtl_c`
--
ALTER TABLE `call_card_dtl_c`
  ADD PRIMARY KEY (`id`),
  ADD KEY `call_card_hdr_c_index` (`hdr_id`),
  ADD KEY `dtl_ori_card_hdr_index` (`call_card_hdr_id`);

--
-- Indexes for table `call_card_hdr`
--
ALTER TABLE `call_card_hdr`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `call_card_hdr_c`
--
ALTER TABLE `call_card_hdr_c`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `cart_dtl`
--
ALTER TABLE `cart_dtl`
  ADD PRIMARY KEY (`id`),
  ADD KEY `cart_dtl_hdr_id` (`hdr_id`),
  ADD KEY `cart_dtl_promotion_hdr_id` (`promotion_hdr_id`);

--
-- Indexes for table `cart_hdr`
--
ALTER TABLE `cart_hdr`
  ADD PRIMARY KEY (`id`),
  ADD KEY `cart_hdr_cust_id` (`customer_id`),
  ADD KEY `cart_hdr_sm_id` (`salesman_id`);

--
-- Indexes for table `check_in_image`
--
ALTER TABLE `check_in_image`
  ADD PRIMARY KEY (`id`),
  ADD KEY `check_in_id_index` (`check_in_id`);

--
-- Indexes for table `check_in_photo_event`
--
ALTER TABLE `check_in_photo_event`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `company`
--
ALTER TABLE `company`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `creditor_cn_dtl`
--
ALTER TABLE `creditor_cn_dtl`
  ADD PRIMARY KEY (`id`),
  ADD KEY `creditor_cn_dtl_hdr_id` (`hdr_id`);

--
-- Indexes for table `creditor_cn_hdr`
--
ALTER TABLE `creditor_cn_hdr`
  ADD PRIMARY KEY (`id`),
  ADD KEY `creditor_cn_hdr_doc_date` (`doc_date`);

--
-- Indexes for table `creditor_payment_dtl`
--
ALTER TABLE `creditor_payment_dtl`
  ADD PRIMARY KEY (`id`),
  ADD KEY `creditor_payment_dtl_hdr_id` (`hdr_id`);

--
-- Indexes for table `creditor_payment_hdr`
--
ALTER TABLE `creditor_payment_hdr`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `creditor_trans`
--
ALTER TABLE `creditor_trans`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `creditor_trans_ko`
--
ALTER TABLE `creditor_trans_ko`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `currency`
--
ALTER TABLE `currency`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `currency_rate`
--
ALTER TABLE `currency_rate`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `customer`
--
ALTER TABLE `customer`
  ADD PRIMARY KEY (`id`),
  ADD KEY `customer_code` (`code`),
  ADD KEY `customer_route_id` (`agent_id`);

--
-- Indexes for table `customer_blacklist`
--
ALTER TABLE `customer_blacklist`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `customer_branch`
--
ALTER TABLE `customer_branch`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `customer_category`
--
ALTER TABLE `customer_category`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `customer_category_1`
--
ALTER TABLE `customer_category_1`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `customer_category_2`
--
ALTER TABLE `customer_category_2`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `customer_contact`
--
ALTER TABLE `customer_contact`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `customer_division`
--
ALTER TABLE `customer_division`
  ADD PRIMARY KEY (`id`),
  ADD KEY `cust_div_cust_id` (`customer_id`),
  ADD KEY `cust_div_div_id` (`division_id`);

--
-- Indexes for table `customer_field`
--
ALTER TABLE `customer_field`
  ADD PRIMARY KEY (`id`),
  ADD KEY `cust_field_cust_id` (`customer_id`);

--
-- Indexes for table `customer_image`
--
ALTER TABLE `customer_image`
  ADD PRIMARY KEY (`id`),
  ADD KEY `cust_image_cust_id` (`customer_id`);

--
-- Indexes for table `customer_inventory`
--
ALTER TABLE `customer_inventory`
  ADD PRIMARY KEY (`id`),
  ADD KEY `customer_inventory_customer_id` (`customer_id`),
  ADD KEY `customer_inventory_item_id` (`item_id`);

--
-- Indexes for table `customer_inventory_history`
--
ALTER TABLE `customer_inventory_history`
  ADD PRIMARY KEY (`id`),
  ADD KEY `cust_inv_hist_customer_id` (`customer_id`),
  ADD KEY `cust_inv_hist_item_id` (`item_id`);

--
-- Indexes for table `customer_ob`
--
ALTER TABLE `customer_ob`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `customer_promotion`
--
ALTER TABLE `customer_promotion`
  ADD PRIMARY KEY (`id`),
  ADD KEY `cust_promo_cust_id` (`customer_id`),
  ADD KEY `cust_promo_div_id` (`division_id`),
  ADD KEY `cust_promo_promo_id` (`promotion_hdr_id`);

--
-- Indexes for table `customer_replenishment_dtl`
--
ALTER TABLE `customer_replenishment_dtl`
  ADD PRIMARY KEY (`id`),
  ADD KEY `replenishment_item_id` (`item_id`);

--
-- Indexes for table `customer_replenishment_hdr`
--
ALTER TABLE `customer_replenishment_hdr`
  ADD PRIMARY KEY (`id`),
  ADD KEY `replenishment_customer_id` (`customer_id`);

--
-- Indexes for table `customer_sell_out`
--
ALTER TABLE `customer_sell_out`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sell_out_customer_id` (`customer_id`),
  ADD KEY `sell_out_item_id` (`item_id`);

--
-- Indexes for table `date_dimension`
--
ALTER TABLE `date_dimension`
  ADD PRIMARY KEY (`date`);

--
-- Indexes for table `debtor_dn_dtl`
--
ALTER TABLE `debtor_dn_dtl`
  ADD PRIMARY KEY (`id`),
  ADD KEY `debtor_dn_dtl_hdr_id` (`hdr_id`);

--
-- Indexes for table `debtor_dn_hdr`
--
ALTER TABLE `debtor_dn_hdr`
  ADD PRIMARY KEY (`id`),
  ADD KEY `debtor_dn_hdr_doc_date` (`doc_date`),
  ADD KEY `debtor_dn_hdr_sm_id` (`salesman_id`);

--
-- Indexes for table `debtor_payment_dtl`
--
ALTER TABLE `debtor_payment_dtl`
  ADD PRIMARY KEY (`id`),
  ADD KEY `debtor_payment_dtl_hdr_id` (`hdr_id`);

--
-- Indexes for table `debtor_payment_hdr`
--
ALTER TABLE `debtor_payment_hdr`
  ADD PRIMARY KEY (`id`),
  ADD KEY `debtor_payment_hdr_cust_id` (`customer_id`),
  ADD KEY `debtor_payment_hdr_sm_id` (`salesman_id`);

--
-- Indexes for table `debtor_payment_image`
--
ALTER TABLE `debtor_payment_image`
  ADD PRIMARY KEY (`id`),
  ADD KEY `dpi_hdr_id_index` (`hdr_id`);

--
-- Indexes for table `debtor_payment_ref`
--
ALTER TABLE `debtor_payment_ref`
  ADD PRIMARY KEY (`id`),
  ADD KEY `debtor_payment_ref_hdr_id` (`hdr_id`);

--
-- Indexes for table `debtor_trans`
--
ALTER TABLE `debtor_trans`
  ADD PRIMARY KEY (`id`),
  ADD KEY `debt_trans_cust_id` (`customer_id`),
  ADD KEY `debt_trans_div_id` (`division_id`),
  ADD KEY `debtor_trans_salesman_id` (`salesman_id`),
  ADD KEY `debt_trans_doc_no` (`doc_no`),
  ADD KEY `debt_trans_doc` (`doc_type`,`doc_id`);

--
-- Indexes for table `debtor_trans_ko`
--
ALTER TABLE `debtor_trans_ko`
  ADD PRIMARY KEY (`id`),
  ADD KEY `debt_ko_hdr_id` (`hdr_id`),
  ADD KEY `debt_ko_doc_id` (`doc_id`);

--
-- Indexes for table `debtor_trans_lg`
--
ALTER TABLE `debtor_trans_lg`
  ADD PRIMARY KEY (`id`),
  ADD KEY `debt_trans_lg_cust_id` (`customer_id`),
  ADD KEY `debt_trans_lg_div_id` (`division_id`);

--
-- Indexes for table `delivery_tracking`
--
ALTER TABLE `delivery_tracking`
  ADD PRIMARY KEY (`id`),
  ADD KEY `tracking_inv` (`do_inv_hdr_id`),
  ADD KEY `tracking_status` (`status`);

--
-- Indexes for table `division`
--
ALTER TABLE `division`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `division_location`
--
ALTER TABLE `division_location`
  ADD PRIMARY KEY (`id`),
  ADD KEY `division_location_index` (`division_id`);

--
-- Indexes for table `document_no`
--
ALTER TABLE `document_no`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `document_no_lock`
--
ALTER TABLE `document_no_lock`
  ADD PRIMARY KEY (`document_no_id`);

--
-- Indexes for table `document_tag`
--
ALTER TABLE `document_tag`
  ADD PRIMARY KEY (`id`),
  ADD KEY `doc_id_type` (`doc_id`,`doc_type`),
  ADD KEY `doc_dtl_type` (`doc_dtl_id`,`doc_type`);

--
-- Indexes for table `doc_hdr_field`
--
ALTER TABLE `doc_hdr_field`
  ADD PRIMARY KEY (`id`),
  ADD KEY `doc_hdr_field_tbl_doc_id` (`table_name`,`doc_id`);

--
-- Indexes for table `do_inv_dtl`
--
ALTER TABLE `do_inv_dtl`
  ADD PRIMARY KEY (`id`),
  ADD KEY `do_inv_dtl_item_id` (`item_id`),
  ADD KEY `do_inv_dtl_hdr_id` (`hdr_id`),
  ADD KEY `do_inv_dtl_promotion_hdr_id` (`promotion_hdr_id`);

--
-- Indexes for table `do_inv_hdr`
--
ALTER TABLE `do_inv_hdr`
  ADD PRIMARY KEY (`id`),
  ADD KEY `do_inv_hdr_cust_id` (`customer_id`),
  ADD KEY `do_inv_hdr_inv_code` (`inv_code`),
  ADD KEY `do_inv_hdr_picking_code` (`picking_code`),
  ADD KEY `do_inv_hdr_shipment_code` (`shipment_code`),
  ADD KEY `do_inv_hdr_status` (`status`),
  ADD KEY `do_inv_hdr_doc_date` (`doc_date`),
  ADD KEY `do_inv_hdr_sm_id` (`salesman_id`),
  ADD KEY `do_inv_hdr_do_code` (`do_code`);

--
-- Indexes for table `gr_pi_dtl`
--
ALTER TABLE `gr_pi_dtl`
  ADD PRIMARY KEY (`id`),
  ADD KEY `gr_pi_dtl_item_id` (`item_id`),
  ADD KEY `gr_pi_dtl_hdr_id` (`hdr_id`);

--
-- Indexes for table `gr_pi_hdr`
--
ALTER TABLE `gr_pi_hdr`
  ADD PRIMARY KEY (`id`),
  ADD KEY `gr_pi_hdr_vendor_id` (`vendor_id`),
  ADD KEY `gr_pi_hdr_doc_date` (`doc_date`);

--
-- Indexes for table `inventory`
--
ALTER TABLE `inventory`
  ADD PRIMARY KEY (`id`),
  ADD KEY `item_location` (`item_id`,`location_id`),
  ADD KEY `inventory_item_id` (`item_id`),
  ADD KEY `inventory_shelf_id` (`shelf_id`),
  ADD KEY `inventory_stock_rotation_id` (`stock_rotation_id`),
  ADD KEY `inventory_company_id` (`company_id`);

--
-- Indexes for table `item`
--
ALTER TABLE `item`
  ADD PRIMARY KEY (`id`),
  ADD KEY `item_code` (`code`),
  ADD KEY `item_status` (`status`),
  ADD KEY `item_item_group_id` (`item_group_id`),
  ADD KEY `item_item_group_01_id` (`item_group_01_id`),
  ADD KEY `item_item_group_02_id` (`item_group_02_id`);

--
-- Indexes for table `item_barcode`
--
ALTER TABLE `item_barcode`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `item_bom`
--
ALTER TABLE `item_bom`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `item_bom_list`
--
ALTER TABLE `item_bom_list`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `item_cost`
--
ALTER TABLE `item_cost`
  ADD PRIMARY KEY (`id`),
  ADD KEY `item_cost_item_id` (`item_id`),
  ADD KEY `item_cost_uom_id` (`uom_id`);

--
-- Indexes for table `item_cost_ref`
--
ALTER TABLE `item_cost_ref`
  ADD PRIMARY KEY (`id`),
  ADD KEY `item_cost_ref_item_id` (`item_id`),
  ADD KEY `item_cost_ref_company_id` (`company_id`);

--
-- Indexes for table `item_division`
--
ALTER TABLE `item_division`
  ADD PRIMARY KEY (`id`),
  ADD KEY `item_division_index` (`item_id`,`division_id`);

--
-- Indexes for table `item_field`
--
ALTER TABLE `item_field`
  ADD PRIMARY KEY (`id`),
  ADD KEY `item_field_item_id` (`item_id`);

--
-- Indexes for table `item_group`
--
ALTER TABLE `item_group`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `item_group_1`
--
ALTER TABLE `item_group_1`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `item_group_2`
--
ALTER TABLE `item_group_2`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `item_image`
--
ALTER TABLE `item_image`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `item_price`
--
ALTER TABLE `item_price`
  ADD PRIMARY KEY (`id`),
  ADD KEY `item_price_item_id` (`item_id`),
  ADD KEY `item_price_uom_id` (`uom_id`);

--
-- Indexes for table `item_price_cbp`
--
ALTER TABLE `item_price_cbp`
  ADD PRIMARY KEY (`id`),
  ADD KEY `item_price_cbp_item_id` (`item_id`),
  ADD KEY `item_price_cbp_uom_id` (`uom_id`);

--
-- Indexes for table `item_price_level`
--
ALTER TABLE `item_price_level`
  ADD PRIMARY KEY (`id`),
  ADD KEY `ipl_item_price_id` (`item_price_id`);

--
-- Indexes for table `item_scp_reorder`
--
ALTER TABLE `item_scp_reorder`
  ADD PRIMARY KEY (`id`),
  ADD KEY `item_scp_reorder_item_id` (`item_id`);

--
-- Indexes for table `item_uom`
--
ALTER TABLE `item_uom`
  ADD PRIMARY KEY (`id`),
  ADD KEY `item_uom_index` (`item_id`,`uom_id`);

--
-- Indexes for table `location`
--
ALTER TABLE `location`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `location_check_in`
--
ALTER TABLE `location_check_in`
  ADD PRIMARY KEY (`id`),
  ADD KEY `lc_division_id` (`division_id`),
  ADD KEY `lc_customer_id` (`customer_id`),
  ADD KEY `lc_salesman_id` (`salesman_id`);

--
-- Indexes for table `mobile_bulletin`
--
ALTER TABLE `mobile_bulletin`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `mobile_download`
--
ALTER TABLE `mobile_download`
  ADD PRIMARY KEY (`id`),
  ADD KEY `mobile_download_profile_table` (`mobile_profile_id`,`table_name`);

--
-- Indexes for table `mobile_history`
--
ALTER TABLE `mobile_history`
  ADD PRIMARY KEY (`id`),
  ADD KEY `profile_table` (`mobile_profile_id`,`table_name`);

--
-- Indexes for table `mobile_profile`
--
ALTER TABLE `mobile_profile`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `mobile_progress`
--
ALTER TABLE `mobile_progress`
  ADD PRIMARY KEY (`mobile_profile_id`);

--
-- Indexes for table `mobile_sync`
--
ALTER TABLE `mobile_sync`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `packing`
--
ALTER TABLE `packing`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `payment_method`
--
ALTER TABLE `payment_method`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `picking`
--
ALTER TABLE `picking`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `picking_reporting`
--
ALTER TABLE `picking_reporting`
  ADD PRIMARY KEY (`id`),
  ADD KEY `picking_reporting_date` (`date`),
  ADD KEY `picking_reporting_mode` (`mode`),
  ADD KEY `picking_reporting_user_id` (`user_id`),
  ADD KEY `picking_reporting_item_id` (`item_id`),
  ADD KEY `picking_reporting_batch_no` (`batch_no`);

--
-- Indexes for table `prch_odr_dtl`
--
ALTER TABLE `prch_odr_dtl`
  ADD PRIMARY KEY (`id`),
  ADD KEY `prch_odr_dtl_hdr_id` (`hdr_id`);

--
-- Indexes for table `prch_odr_hdr`
--
ALTER TABLE `prch_odr_hdr`
  ADD PRIMARY KEY (`id`),
  ADD KEY `prch_odr_hdr_doc_date` (`doc_date`);

--
-- Indexes for table `prch_req_dtl`
--
ALTER TABLE `prch_req_dtl`
  ADD PRIMARY KEY (`id`),
  ADD KEY `prch_req_dtl_hdr_id` (`hdr_id`);

--
-- Indexes for table `prch_req_hdr`
--
ALTER TABLE `prch_req_hdr`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `prch_return_tracking`
--
ALTER TABLE `prch_return_tracking`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `prch_ret_dtl`
--
ALTER TABLE `prch_ret_dtl`
  ADD PRIMARY KEY (`id`),
  ADD KEY `prch_ret_dtl_hdr_id` (`hdr_id`);

--
-- Indexes for table `prch_ret_hdr`
--
ALTER TABLE `prch_ret_hdr`
  ADD PRIMARY KEY (`id`),
  ADD KEY `prch_ret_hdr_doc_date` (`doc_date`);

--
-- Indexes for table `prch_tracking`
--
ALTER TABLE `prch_tracking`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `price_group`
--
ALTER TABLE `price_group`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `price_group_customer_category`
--
ALTER TABLE `price_group_customer_category`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `price_group_customer_category_1`
--
ALTER TABLE `price_group_customer_category_1`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `price_group_customer_category_2`
--
ALTER TABLE `price_group_customer_category_2`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `project`
--
ALTER TABLE `project`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `promotion_alloc`
--
ALTER TABLE `promotion_alloc`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `promotion_division`
--
ALTER TABLE `promotion_division`
  ADD PRIMARY KEY (`id`),
  ADD KEY `promo_div_div_id` (`division_id`),
  ADD KEY `promo_div_promo_id` (`promotion_hdr_id`);

--
-- Indexes for table `promotion_dtl`
--
ALTER TABLE `promotion_dtl`
  ADD PRIMARY KEY (`id`),
  ADD KEY `promotion_dtl_hdr_id` (`promotion_hdr_id`);

--
-- Indexes for table `promotion_hdr`
--
ALTER TABLE `promotion_hdr`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `promotion_image`
--
ALTER TABLE `promotion_image`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `rd_dn_dtl`
--
ALTER TABLE `rd_dn_dtl`
  ADD PRIMARY KEY (`id`),
  ADD KEY `rd_dn_dtl_item_id` (`item_id`),
  ADD KEY `rd_dn_dtl_hdr_id` (`hdr_id`);

--
-- Indexes for table `rd_dn_hdr`
--
ALTER TABLE `rd_dn_hdr`
  ADD PRIMARY KEY (`id`),
  ADD KEY `rd_dn_hdr_vendor_id` (`vendor_id`),
  ADD KEY `rd_dn_hdr_doc_date` (`doc_date`);

--
-- Indexes for table `reason`
--
ALTER TABLE `reason`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `return_tracking`
--
ALTER TABLE `return_tracking`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `route`
--
ALTER TABLE `route`
  ADD PRIMARY KEY (`id`),
  ADD KEY `route_code` (`code`),
  ADD KEY `route_vehicle_code` (`vehicle_code`);

--
-- Indexes for table `route_criteria`
--
ALTER TABLE `route_criteria`
  ADD PRIMARY KEY (`id`),
  ADD KEY `route_criteria_route_id` (`route_id`);

--
-- Indexes for table `route_customer`
--
ALTER TABLE `route_customer`
  ADD PRIMARY KEY (`id`),
  ADD KEY `route_cust_cust_id` (`customer_id`),
  ADD KEY `route_cust_route_id` (`route_id`),
  ADD KEY `route_branch_route_id` (`customer_id`,`branch_id`);

--
-- Indexes for table `route_division`
--
ALTER TABLE `route_division`
  ADD PRIMARY KEY (`id`),
  ADD KEY `route_div_division_id` (`division_id`),
  ADD KEY `route_div_route_id` (`route_id`);

--
-- Indexes for table `route_plan`
--
ALTER TABLE `route_plan`
  ADD PRIMARY KEY (`id`),
  ADD KEY `rp_division_id` (`division_id`),
  ADD KEY `rp_customer_id` (`customer_id`),
  ADD KEY `rp_salesman_id` (`salesman_id`);

--
-- Indexes for table `route_plan_import`
--
ALTER TABLE `route_plan_import`
  ADD PRIMARY KEY (`id`),
  ADD KEY `route_cust_id` (`customer_id`),
  ADD KEY `route_sm_id` (`salesman_id`);

--
-- Indexes for table `rr_cn_dtl`
--
ALTER TABLE `rr_cn_dtl`
  ADD PRIMARY KEY (`id`),
  ADD KEY `rr_cn_dtl_item_id` (`item_id`),
  ADD KEY `rr_cn_dtl_hdr_id` (`hdr_id`);

--
-- Indexes for table `rr_cn_hdr`
--
ALTER TABLE `rr_cn_hdr`
  ADD PRIMARY KEY (`id`),
  ADD KEY `rr_cn_hdr_cust_id` (`customer_id`),
  ADD KEY `rr_cn_hdr_doc_date` (`doc_date`),
  ADD KEY `rr_cn_hdr_sm_id` (`salesman_id`);

--
-- Indexes for table `salesman_commission`
--
ALTER TABLE `salesman_commission`
  ADD PRIMARY KEY (`id`),
  ADD KEY `salesman_commission_user_id` (`user_id`);

--
-- Indexes for table `salesman_item_group`
--
ALTER TABLE `salesman_item_group`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `salesteam`
--
ALTER TABLE `salesteam`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `salesteam_member`
--
ALTER TABLE `salesteam_member`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `sales_odr_dtl`
--
ALTER TABLE `sales_odr_dtl`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sales_odr_dtl_hdr_id` (`hdr_id`),
  ADD KEY `sales_odr_dtl_promotion_hdr_id` (`promotion_hdr_id`);

--
-- Indexes for table `sales_odr_dtl_c`
--
ALTER TABLE `sales_odr_dtl_c`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sales_odr_hdr_c_index` (`hdr_id`),
  ADD KEY `dtl_ori_odr_hdr_index` (`sales_odr_hdr_id`);

--
-- Indexes for table `sales_odr_hdr`
--
ALTER TABLE `sales_odr_hdr`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sales_odr_hdr_cust_id` (`customer_id`),
  ADD KEY `sales_odr_hdr_status` (`status`),
  ADD KEY `sales_odr_hdr_doc_code` (`doc_code`),
  ADD KEY `sales_odr_hdr_doc_date` (`doc_date`),
  ADD KEY `sales_odr_hdr_sm_id` (`salesman_id`);

--
-- Indexes for table `sales_odr_hdr_c`
--
ALTER TABLE `sales_odr_hdr_c`
  ADD PRIMARY KEY (`id`),
  ADD KEY `ori_odr_hdr_index` (`sales_odr_hdr_id`),
  ADD KEY `sales_odr_hdr_c_cust_id` (`customer_id`),
  ADD KEY `sales_odr_hdr_c_div_id` (`division_id`),
  ADD KEY `sales_odr_hdr_c_sm_id` (`salesman_id`);

--
-- Indexes for table `sales_reporting`
--
ALTER TABLE `sales_reporting`
  ADD PRIMARY KEY (`id`,`year`,`month`,`doc_date`);

--
-- Indexes for table `sales_ret_dtl`
--
ALTER TABLE `sales_ret_dtl`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sales_ret_dtl_hdr_id` (`hdr_id`);

--
-- Indexes for table `sales_ret_dtl_c`
--
ALTER TABLE `sales_ret_dtl_c`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sales_ret_dtl_c_hdr_id` (`hdr_id`);

--
-- Indexes for table `sales_ret_hdr`
--
ALTER TABLE `sales_ret_hdr`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sales_ret_hdr_doc_date` (`doc_date`),
  ADD KEY `sales_ret_hdr_sm_id` (`salesman_id`),
  ADD KEY `sales_ret_hdr_shipment_code` (`shipment_code`);

--
-- Indexes for table `sales_ret_hdr_c`
--
ALTER TABLE `sales_ret_hdr_c`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `sales_tracking`
--
ALTER TABLE `sales_tracking`
  ADD PRIMARY KEY (`id`),
  ADD KEY `st_customer_id` (`customer_id`),
  ADD KEY `st_salesman_id` (`salesman_id`),
  ADD KEY `st_sales_odr_hdr_id` (`sales_odr_hdr_id`),
  ADD KEY `st_sales_odr_dtl_id` (`sales_odr_dtl_id`),
  ADD KEY `st_do_inv_hdr_id` (`do_inv_hdr_id`),
  ADD KEY `st_do_inv_dtl_id` (`do_inv_dtl_id`);

--
-- Indexes for table `shelf`
--
ALTER TABLE `shelf`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `shelf_aisle`
--
ALTER TABLE `shelf_aisle`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `shelf_bay`
--
ALTER TABLE `shelf_bay`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `shelf_level`
--
ALTER TABLE `shelf_level`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `stk_adj_dtl`
--
ALTER TABLE `stk_adj_dtl`
  ADD PRIMARY KEY (`id`),
  ADD KEY `stk_adj_dtl_hdr_id` (`hdr_id`);

--
-- Indexes for table `stk_adj_hdr`
--
ALTER TABLE `stk_adj_hdr`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `stk_count_dtl`
--
ALTER TABLE `stk_count_dtl`
  ADD PRIMARY KEY (`id`),
  ADD KEY `stk_count_dtl_hdr_id` (`hdr_id`);

--
-- Indexes for table `stk_count_hdr`
--
ALTER TABLE `stk_count_hdr`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `stk_issue_dtl`
--
ALTER TABLE `stk_issue_dtl`
  ADD PRIMARY KEY (`id`),
  ADD KEY `stk_issue_dtl_hdr_id` (`hdr_id`);

--
-- Indexes for table `stk_issue_hdr`
--
ALTER TABLE `stk_issue_hdr`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `stk_recv_dtl`
--
ALTER TABLE `stk_recv_dtl`
  ADD PRIMARY KEY (`id`),
  ADD KEY `stk_recv_dtl_hdr_id` (`hdr_id`);

--
-- Indexes for table `stk_recv_hdr`
--
ALTER TABLE `stk_recv_hdr`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `stk_reserve_trans`
--
ALTER TABLE `stk_reserve_trans`
  ADD PRIMARY KEY (`id`),
  ADD KEY `reserve_doc` (`doc_id`,`doc_type`),
  ADD KEY `reserve_ref_no` (`ref_no_02`);

--
-- Indexes for table `stk_trans`
--
ALTER TABLE `stk_trans`
  ADD PRIMARY KEY (`id`),
  ADD KEY `trans_doc` (`doc_id`,`doc_type`),
  ADD KEY `trans_inventory` (`inventory_id`),
  ADD KEY `stk_trans_item_id` (`item_id`),
  ADD KEY `stk_trans_createdby` (`createdby`),
  ADD KEY `stk_trans_lastavgcost` (`item_id`,`doc_date`);

--
-- Indexes for table `stk_transfer_dtl`
--
ALTER TABLE `stk_transfer_dtl`
  ADD PRIMARY KEY (`id`),
  ADD KEY `stk_transfer_dtl_hdr_id` (`hdr_id`);

--
-- Indexes for table `stk_transfer_hdr`
--
ALTER TABLE `stk_transfer_hdr`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `stock_rotation`
--
ALTER TABLE `stock_rotation`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `system_settings`
--
ALTER TABLE `system_settings`
  ADD PRIMARY KEY (`id`),
  ADD KEY `system_settings_code` (`code`);

--
-- Indexes for table `target_collection`
--
ALTER TABLE `target_collection`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_target_collection_index` (`user_id`);

--
-- Indexes for table `target_division`
--
ALTER TABLE `target_division`
  ADD PRIMARY KEY (`id`),
  ADD KEY `division_target_division_index` (`division_id`);

--
-- Indexes for table `target_item_group`
--
ALTER TABLE `target_item_group`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_target_item_index` (`user_id`),
  ADD KEY `target_item_group_id` (`item_group_id`),
  ADD KEY `target_item_group_01_id` (`item_group_01_id`),
  ADD KEY `target_item_group_02_id` (`item_group_02_id`);

--
-- Indexes for table `target_personal`
--
ALTER TABLE `target_personal`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_target_personal_index` (`user_id`);

--
-- Indexes for table `tax`
--
ALTER TABLE `tax`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `tax_filing`
--
ALTER TABLE `tax_filing`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `tax_group`
--
ALTER TABLE `tax_group`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `tax_trans`
--
ALTER TABLE `tax_trans`
  ADD PRIMARY KEY (`id`),
  ADD KEY `tax_trans_tax_group_id` (`tax_group_id`),
  ADD KEY `tax_trans_tax_group_code` (`tax_group_code`),
  ADD KEY `tax_trans_tax_id` (`tax_id`),
  ADD KEY `tax_trans_tax_code` (`tax_code`);

--
-- Indexes for table `terms`
--
ALTER TABLE `terms`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `terms_type`
--
ALTER TABLE `terms_type`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `transport`
--
ALTER TABLE `transport`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `trial_balance`
--
ALTER TABLE `trial_balance`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `uom`
--
ALTER TABLE `uom`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `user_customer`
--
ALTER TABLE `user_customer`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_cust_cust_id` (`customer_id`),
  ADD KEY `user_cust_user_id` (`user_id`);

--
-- Indexes for table `user_division`
--
ALTER TABLE `user_division`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_division_user_id` (`user_id`),
  ADD KEY `user_division_div_id` (`division_id`);

--
-- Indexes for table `user_exclude_item_group`
--
ALTER TABLE `user_exclude_item_group`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_exclude_item_group_user_id` (`user_id`);

--
-- Indexes for table `user_image`
--
ALTER TABLE `user_image`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_image_id_index` (`user_id`);

--
-- Indexes for table `user_item`
--
ALTER TABLE `user_item`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `user_item_group`
--
ALTER TABLE `user_item_group`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_item_group_user_id` (`user_id`);

--
-- Indexes for table `user_profiles`
--
ALTER TABLE `user_profiles`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `user_profiles_fields`
--
ALTER TABLE `user_profiles_fields`
  ADD PRIMARY KEY (`id`),
  ADD KEY `varname` (`varname`,`widget`,`visible`);

--
-- Indexes for table `user_vendor`
--
ALTER TABLE `user_vendor`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_vendor_vendor_id` (`vendor_id`),
  ADD KEY `user_vendor_user_id` (`user_id`);

--
-- Indexes for table `van_sales_settings`
--
ALTER TABLE `van_sales_settings`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `vendor`
--
ALTER TABLE `vendor`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `vendor_branch`
--
ALTER TABLE `vendor_branch`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `vendor_category`
--
ALTER TABLE `vendor_category`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `vendor_contact`
--
ALTER TABLE `vendor_contact`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `vendor_division`
--
ALTER TABLE `vendor_division`
  ADD PRIMARY KEY (`id`),
  ADD KEY `vendor_div_vendor_id` (`vendor_id`),
  ADD KEY `vendor_div_division_id` (`division_id`);

--
-- Indexes for table `vendor_ob`
--
ALTER TABLE `vendor_ob`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `visit_dtl`
--
ALTER TABLE `visit_dtl`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `visit_hdr`
--
ALTER TABLE `visit_hdr`
  ADD PRIMARY KEY (`id`),
  ADD KEY `visit_hdr_division_id` (`division_id`),
  ADD KEY `visit_hdr_customer_id` (`customer_id`),
  ADD KEY `visit_hdr_salesman_id` (`salesman_id`);

--
-- Indexes for table `wnd_user`
--
ALTER TABLE `wnd_user`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `workflow_node`
--
ALTER TABLE `workflow_node`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `z_debtor_aging`
--
ALTER TABLE `z_debtor_aging`
  ADD PRIMARY KEY (`id`),
  ADD KEY `z_debtor_trans_id` (`debtor_trans_id`),
  ADD KEY `deletion_idx` (`createdby`,`report_id`,`salesman_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `area`
--
ALTER TABLE `area`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `audit_trail`
--
ALTER TABLE `audit_trail`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `barcode`
--
ALTER TABLE `barcode`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `call_card_dtl`
--
ALTER TABLE `call_card_dtl`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `call_card_dtl_c`
--
ALTER TABLE `call_card_dtl_c`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `call_card_hdr`
--
ALTER TABLE `call_card_hdr`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `call_card_hdr_c`
--
ALTER TABLE `call_card_hdr_c`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `cart_dtl`
--
ALTER TABLE `cart_dtl`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `cart_hdr`
--
ALTER TABLE `cart_hdr`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `check_in_image`
--
ALTER TABLE `check_in_image`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `check_in_photo_event`
--
ALTER TABLE `check_in_photo_event`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `company`
--
ALTER TABLE `company`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `creditor_cn_dtl`
--
ALTER TABLE `creditor_cn_dtl`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `creditor_cn_hdr`
--
ALTER TABLE `creditor_cn_hdr`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `creditor_payment_dtl`
--
ALTER TABLE `creditor_payment_dtl`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `creditor_payment_hdr`
--
ALTER TABLE `creditor_payment_hdr`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `creditor_trans`
--
ALTER TABLE `creditor_trans`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `creditor_trans_ko`
--
ALTER TABLE `creditor_trans_ko`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `currency`
--
ALTER TABLE `currency`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `currency_rate`
--
ALTER TABLE `currency_rate`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `customer`
--
ALTER TABLE `customer`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `customer_blacklist`
--
ALTER TABLE `customer_blacklist`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `customer_branch`
--
ALTER TABLE `customer_branch`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `customer_category`
--
ALTER TABLE `customer_category`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `customer_category_1`
--
ALTER TABLE `customer_category_1`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `customer_category_2`
--
ALTER TABLE `customer_category_2`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `customer_contact`
--
ALTER TABLE `customer_contact`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `customer_division`
--
ALTER TABLE `customer_division`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `customer_field`
--
ALTER TABLE `customer_field`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `customer_image`
--
ALTER TABLE `customer_image`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `customer_inventory`
--
ALTER TABLE `customer_inventory`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `customer_inventory_history`
--
ALTER TABLE `customer_inventory_history`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `customer_ob`
--
ALTER TABLE `customer_ob`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `customer_promotion`
--
ALTER TABLE `customer_promotion`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `customer_replenishment_dtl`
--
ALTER TABLE `customer_replenishment_dtl`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `customer_replenishment_hdr`
--
ALTER TABLE `customer_replenishment_hdr`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `customer_sell_out`
--
ALTER TABLE `customer_sell_out`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `debtor_dn_dtl`
--
ALTER TABLE `debtor_dn_dtl`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `debtor_dn_hdr`
--
ALTER TABLE `debtor_dn_hdr`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `debtor_payment_dtl`
--
ALTER TABLE `debtor_payment_dtl`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `debtor_payment_hdr`
--
ALTER TABLE `debtor_payment_hdr`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `debtor_payment_image`
--
ALTER TABLE `debtor_payment_image`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `debtor_payment_ref`
--
ALTER TABLE `debtor_payment_ref`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `debtor_trans`
--
ALTER TABLE `debtor_trans`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `debtor_trans_ko`
--
ALTER TABLE `debtor_trans_ko`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `debtor_trans_lg`
--
ALTER TABLE `debtor_trans_lg`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `delivery_tracking`
--
ALTER TABLE `delivery_tracking`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `division`
--
ALTER TABLE `division`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `division_location`
--
ALTER TABLE `division_location`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `document_no`
--
ALTER TABLE `document_no`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=27;
--
-- AUTO_INCREMENT for table `document_tag`
--
ALTER TABLE `document_tag`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `doc_hdr_field`
--
ALTER TABLE `doc_hdr_field`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `do_inv_dtl`
--
ALTER TABLE `do_inv_dtl`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `do_inv_hdr`
--
ALTER TABLE `do_inv_hdr`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `gr_pi_dtl`
--
ALTER TABLE `gr_pi_dtl`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `gr_pi_hdr`
--
ALTER TABLE `gr_pi_hdr`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `inventory`
--
ALTER TABLE `inventory`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `item`
--
ALTER TABLE `item`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `item_barcode`
--
ALTER TABLE `item_barcode`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `item_bom`
--
ALTER TABLE `item_bom`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `item_bom_list`
--
ALTER TABLE `item_bom_list`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `item_cost`
--
ALTER TABLE `item_cost`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `item_cost_ref`
--
ALTER TABLE `item_cost_ref`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `item_division`
--
ALTER TABLE `item_division`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `item_field`
--
ALTER TABLE `item_field`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `item_group`
--
ALTER TABLE `item_group`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `item_group_1`
--
ALTER TABLE `item_group_1`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `item_group_2`
--
ALTER TABLE `item_group_2`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `item_image`
--
ALTER TABLE `item_image`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `item_price`
--
ALTER TABLE `item_price`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `item_price_cbp`
--
ALTER TABLE `item_price_cbp`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `item_price_level`
--
ALTER TABLE `item_price_level`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `item_scp_reorder`
--
ALTER TABLE `item_scp_reorder`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `item_uom`
--
ALTER TABLE `item_uom`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `location`
--
ALTER TABLE `location`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `location_check_in`
--
ALTER TABLE `location_check_in`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `mobile_bulletin`
--
ALTER TABLE `mobile_bulletin`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `mobile_download`
--
ALTER TABLE `mobile_download`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `mobile_history`
--
ALTER TABLE `mobile_history`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `mobile_profile`
--
ALTER TABLE `mobile_profile`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `mobile_sync`
--
ALTER TABLE `mobile_sync`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `packing`
--
ALTER TABLE `packing`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `payment_method`
--
ALTER TABLE `payment_method`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `picking`
--
ALTER TABLE `picking`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `picking_reporting`
--
ALTER TABLE `picking_reporting`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `prch_odr_dtl`
--
ALTER TABLE `prch_odr_dtl`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `prch_odr_hdr`
--
ALTER TABLE `prch_odr_hdr`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `prch_req_dtl`
--
ALTER TABLE `prch_req_dtl`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `prch_req_hdr`
--
ALTER TABLE `prch_req_hdr`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `prch_return_tracking`
--
ALTER TABLE `prch_return_tracking`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `prch_ret_dtl`
--
ALTER TABLE `prch_ret_dtl`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `prch_ret_hdr`
--
ALTER TABLE `prch_ret_hdr`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `prch_tracking`
--
ALTER TABLE `prch_tracking`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `price_group`
--
ALTER TABLE `price_group`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `price_group_customer_category`
--
ALTER TABLE `price_group_customer_category`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `price_group_customer_category_1`
--
ALTER TABLE `price_group_customer_category_1`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `price_group_customer_category_2`
--
ALTER TABLE `price_group_customer_category_2`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `project`
--
ALTER TABLE `project`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `promotion_alloc`
--
ALTER TABLE `promotion_alloc`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `promotion_division`
--
ALTER TABLE `promotion_division`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `promotion_dtl`
--
ALTER TABLE `promotion_dtl`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `promotion_hdr`
--
ALTER TABLE `promotion_hdr`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `promotion_image`
--
ALTER TABLE `promotion_image`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `rd_dn_dtl`
--
ALTER TABLE `rd_dn_dtl`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `rd_dn_hdr`
--
ALTER TABLE `rd_dn_hdr`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `reason`
--
ALTER TABLE `reason`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `return_tracking`
--
ALTER TABLE `return_tracking`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `route`
--
ALTER TABLE `route`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `route_criteria`
--
ALTER TABLE `route_criteria`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `route_customer`
--
ALTER TABLE `route_customer`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `route_division`
--
ALTER TABLE `route_division`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `route_plan`
--
ALTER TABLE `route_plan`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `route_plan_import`
--
ALTER TABLE `route_plan_import`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `rr_cn_dtl`
--
ALTER TABLE `rr_cn_dtl`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `rr_cn_hdr`
--
ALTER TABLE `rr_cn_hdr`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `salesman_commission`
--
ALTER TABLE `salesman_commission`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `salesman_item_group`
--
ALTER TABLE `salesman_item_group`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `salesteam`
--
ALTER TABLE `salesteam`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `salesteam_member`
--
ALTER TABLE `salesteam_member`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `sales_odr_dtl`
--
ALTER TABLE `sales_odr_dtl`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `sales_odr_dtl_c`
--
ALTER TABLE `sales_odr_dtl_c`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `sales_odr_hdr`
--
ALTER TABLE `sales_odr_hdr`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `sales_odr_hdr_c`
--
ALTER TABLE `sales_odr_hdr_c`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `sales_ret_dtl`
--
ALTER TABLE `sales_ret_dtl`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `sales_ret_dtl_c`
--
ALTER TABLE `sales_ret_dtl_c`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `sales_ret_hdr`
--
ALTER TABLE `sales_ret_hdr`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `sales_ret_hdr_c`
--
ALTER TABLE `sales_ret_hdr_c`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `sales_tracking`
--
ALTER TABLE `sales_tracking`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `shelf`
--
ALTER TABLE `shelf`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `shelf_aisle`
--
ALTER TABLE `shelf_aisle`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `shelf_bay`
--
ALTER TABLE `shelf_bay`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `shelf_level`
--
ALTER TABLE `shelf_level`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `stk_adj_dtl`
--
ALTER TABLE `stk_adj_dtl`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `stk_adj_hdr`
--
ALTER TABLE `stk_adj_hdr`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `stk_count_dtl`
--
ALTER TABLE `stk_count_dtl`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `stk_count_hdr`
--
ALTER TABLE `stk_count_hdr`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `stk_issue_dtl`
--
ALTER TABLE `stk_issue_dtl`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `stk_issue_hdr`
--
ALTER TABLE `stk_issue_hdr`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `stk_recv_dtl`
--
ALTER TABLE `stk_recv_dtl`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `stk_recv_hdr`
--
ALTER TABLE `stk_recv_hdr`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `stk_reserve_trans`
--
ALTER TABLE `stk_reserve_trans`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `stk_trans`
--
ALTER TABLE `stk_trans`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `stk_transfer_dtl`
--
ALTER TABLE `stk_transfer_dtl`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `stk_transfer_hdr`
--
ALTER TABLE `stk_transfer_hdr`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `stock_rotation`
--
ALTER TABLE `stock_rotation`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `system_settings`
--
ALTER TABLE `system_settings`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=95;
--
-- AUTO_INCREMENT for table `target_collection`
--
ALTER TABLE `target_collection`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `target_division`
--
ALTER TABLE `target_division`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `target_item_group`
--
ALTER TABLE `target_item_group`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `target_personal`
--
ALTER TABLE `target_personal`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `tax`
--
ALTER TABLE `tax`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=101;
--
-- AUTO_INCREMENT for table `tax_filing`
--
ALTER TABLE `tax_filing`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `tax_group`
--
ALTER TABLE `tax_group`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=1000;
--
-- AUTO_INCREMENT for table `tax_trans`
--
ALTER TABLE `tax_trans`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `terms`
--
ALTER TABLE `terms`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=100000;
--
-- AUTO_INCREMENT for table `terms_type`
--
ALTER TABLE `terms_type`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=13;
--
-- AUTO_INCREMENT for table `transport`
--
ALTER TABLE `transport`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `trial_balance`
--
ALTER TABLE `trial_balance`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `uom`
--
ALTER TABLE `uom`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `user_customer`
--
ALTER TABLE `user_customer`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `user_division`
--
ALTER TABLE `user_division`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `user_exclude_item_group`
--
ALTER TABLE `user_exclude_item_group`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `user_image`
--
ALTER TABLE `user_image`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `user_item`
--
ALTER TABLE `user_item`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `user_item_group`
--
ALTER TABLE `user_item_group`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `user_profiles_fields`
--
ALTER TABLE `user_profiles_fields`
  MODIFY `id` int(10) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT for table `user_vendor`
--
ALTER TABLE `user_vendor`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `van_sales_settings`
--
ALTER TABLE `van_sales_settings`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `vendor`
--
ALTER TABLE `vendor`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `vendor_branch`
--
ALTER TABLE `vendor_branch`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `vendor_category`
--
ALTER TABLE `vendor_category`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `vendor_contact`
--
ALTER TABLE `vendor_contact`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `vendor_division`
--
ALTER TABLE `vendor_division`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `vendor_ob`
--
ALTER TABLE `vendor_ob`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `visit_dtl`
--
ALTER TABLE `visit_dtl`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `visit_hdr`
--
ALTER TABLE `visit_hdr`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `wnd_user`
--
ALTER TABLE `wnd_user`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `workflow_node`
--
ALTER TABLE `workflow_node`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `z_debtor_aging`
--
ALTER TABLE `z_debtor_aging`
  MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT;
--
-- Constraints for dumped tables
--

--
-- Constraints for table `authassignment`
--
ALTER TABLE `authassignment`
  ADD CONSTRAINT `authassignment_ibfk_1` FOREIGN KEY (`itemname`) REFERENCES `authitem` (`name`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `authitemchild`
--
ALTER TABLE `authitemchild`
  ADD CONSTRAINT `authitemchild_ibfk_1` FOREIGN KEY (`parent`) REFERENCES `authitem` (`name`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `authitemchild_ibfk_2` FOREIGN KEY (`child`) REFERENCES `authitem` (`name`) ON DELETE CASCADE ON UPDATE CASCADE;

