-- phpMyAdmin SQL Dump
-- version 3.4.9
-- http://www.phpmyadmin.net
--
-- 主机: localhost
-- 生成日期: 2012 年 04 月 06 日 15:29
-- 服务器版本: 5.5.8
-- PHP 版本: 5.3.5

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


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

--
-- 数据库: `dcinv104hki`
--

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

--
-- 表的结构 `accessrights`
--

CREATE TABLE IF NOT EXISTS `accessrights` (
  `LoginName` char(10) NOT NULL,
  `CompanyCode` char(3) NOT NULL,
  `Screen` char(20) NOT NULL,
  `Authorized` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`LoginName`,`CompanyCode`,`Screen`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=1 COMMENT='User access rights for menu items.';

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

--
-- 表的结构 `accessscreen`
--

CREATE TABLE IF NOT EXISTS `accessscreen` (
  `Screen` char(20) NOT NULL,
  `SecurityLevel` char(1) NOT NULL DEFAULT '4',
  `Operator` tinyint(1) NOT NULL DEFAULT '1',
  `Available` tinyint(1) NOT NULL DEFAULT '1',
  `System` tinyint(1) NOT NULL DEFAULT '0',
  `Checking` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`Screen`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0 COMMENT='All Menu Item getName()';

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

--
-- 表的结构 `account`
--

CREATE TABLE IF NOT EXISTS `account` (
  `AccountID` char(6) NOT NULL,
  `CompanyCode` char(3) NOT NULL DEFAULT '',
  `IfCustomer` tinyint(1) NOT NULL DEFAULT '1',
  `Status` char(1) NOT NULL DEFAULT '',
  `Name` char(60) NOT NULL,
  `NameinForeign` char(60) NOT NULL,
  `Address` char(60) NOT NULL,
  `City` char(15) NOT NULL DEFAULT '',
  `Province` char(20) NOT NULL DEFAULT '',
  `Country` char(3) NOT NULL DEFAULT '',
  `PostalCode` char(6) NOT NULL,
  `Tel` char(20) NOT NULL,
  `Fax` char(20) NOT NULL,
  `WebSite` char(40) NOT NULL,
  `email` char(40) NOT NULL DEFAULT '',
  `BriefName` char(10) NOT NULL,
  `SalesCode` char(4) NOT NULL DEFAULT '',
  `AccountCurrency` char(3) NOT NULL DEFAULT '',
  `CreditLimit` int(11) NOT NULL DEFAULT '0',
  `PaymentTerm` char(3) NOT NULL DEFAULT '',
  `OrderLimit` int(11) NOT NULL DEFAULT '9999999',
  `LastTransDate` date NOT NULL DEFAULT '2999-01-01' COMMENT 'Last Transaction(P.Invoice/S.Invoice in Accounting)Date',
  `LastStockingDate` date NOT NULL DEFAULT '2999-01-01' COMMENT 'Last date for goods in/out (not including holdQty)Stock',
  `SecurityLevel` char(1) NOT NULL DEFAULT '',
  `ParentCompany` char(6) NOT NULL,
  `SubLedgerCode` char(3) NOT NULL DEFAULT '',
  `ContactPerson` char(20) NOT NULL,
  `Sex` tinyint(1) NOT NULL DEFAULT '1',
  `ContactPersonTel` char(20) NOT NULL,
  `ContactPersonEmail` char(40) NOT NULL,
  `Remark` char(60) NOT NULL,
  `datecodeFormat` char(10) NOT NULL DEFAULT '',
  `PackageIDFormat` char(15) NOT NULL DEFAULT '',
  `AddBy` char(10) NOT NULL,
  `AddTime` datetime NOT NULL DEFAULT '2999-01-01 00:00:00',
  `UpdateBy` char(10) NOT NULL DEFAULT '',
  `UpdateTime` datetime NOT NULL DEFAULT '2999-01-01 00:00:00',
  PRIMARY KEY (`Name`,`AccountID`,`CompanyCode`,`IfCustomer`),
  UNIQUE KEY `AccountID` (`AccountID`,`CompanyCode`,`IfCustomer`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

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

--
-- 表的结构 `autonumber`
--

CREATE TABLE IF NOT EXISTS `autonumber` (
  `CompanyCode` char(3) NOT NULL,
  `Type` char(15) NOT NULL,
  `Prefix` char(3) NOT NULL,
  `CurNumber` int(6) NOT NULL,
  PRIMARY KEY (`CompanyCode`,`Type`,`Prefix`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

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

--
-- 表的结构 `booleansettings`
--

CREATE TABLE IF NOT EXISTS `booleansettings` (
  `CompanyCode` char(3) NOT NULL,
  `Type` char(15) NOT NULL,
  `Prefix` char(3) NOT NULL,
  `CatChecking` char(10) NOT NULL COMMENT 'TextPrefix:need TextField, Blank:No need, Other: combo value in TypeList',
  `Activate` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'If no record inDB, cannot set to true',
  `DBName` char(20) NOT NULL DEFAULT '',
  `Remark` char(40) NOT NULL,
  `UpdateBy` char(10) NOT NULL DEFAULT '',
  `UpdateTime` datetime NOT NULL DEFAULT '2999-01-01 00:00:00',
  PRIMARY KEY (`CompanyCode`,`Type`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

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

--
-- 表的结构 `boolsetoriginal`
--

CREATE TABLE IF NOT EXISTS `boolsetoriginal` (
  `CompanyCode` char(3) NOT NULL,
  `Type` char(15) NOT NULL,
  `Prefix` char(3) NOT NULL,
  `CatChecking` char(10) NOT NULL COMMENT 'TextPrefix:need TextField, Blank:No need, Other: combo value in TypeList',
  `Activate` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'If no record inDB, cannot set to true',
  `DBName` char(20) NOT NULL DEFAULT '',
  `Remark` char(40) NOT NULL,
  `UpdateBy` char(10) NOT NULL DEFAULT '',
  `UpdateTime` datetime NOT NULL DEFAULT '2999-01-01 00:00:00',
  PRIMARY KEY (`CompanyCode`,`Type`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

--
-- 转存表中的数据 `boolsetoriginal`
--

INSERT INTO `boolsetoriginal` (`CompanyCode`, `Type`, `Prefix`, `CatChecking`, `Activate`, `DBName`, `Remark`, `UpdateBy`, `UpdateTime`) VALUES
('', 'Inv_Need_WHLoca', '', '', 1, 'WarehouseChamber', '入庫時必須輸入倉庫位置', '', '2999-01-01 00:00:00'),
('', 'Inv_Need_Cust', '', '', 0, 'Account', '入庫時必須輸入客戶號碼', '', '2999-01-01 00:00:00'),
('', 'Inv_Need_Sales', 'SC', 'StaffType', 0, 'Staff', '入庫時必須輸入銷售員', '', '2999-01-01 00:00:00'),
('', 'InvIn_I_AutoOrd', 'PI', 'TextPrefix', 1, '', '入庫自動單號', '', '2999-01-01 00:00:00'),
('', 'Inv_Out_AutoOrd', 'SI', 'TextPrefix', 1, '', '出庫自動單號', '', '2999-01-01 00:00:00'),
('', 'Inv_Rev_AutoOrd', 'RV', 'TextPrefix', 1, '', '成本調整自動單號', '', '2999-01-01 00:00:00'),
('', 'Inv_Upk_AutoOrd', 'UP', 'TextPrefix', 1, '', '拆箱自動單號', '', '2999-01-01 00:00:00'),
('', 'Inv_Adj_AutoOrd', 'AJ', 'TextPrefix', 1, '', '數量調整自動單號', '', '2999-01-01 00:00:00'),
('', 'Inv_Trf_AutoOrd', 'TF', 'TextPrefix', 1, '', '轉倉自動單號', '', '2999-01-01 00:00:00');

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

--
-- 表的结构 `company`
--

CREATE TABLE IF NOT EXISTS `company` (
  `Code` char(3) NOT NULL,
  `Name` char(45) NOT NULL,
  `NameInForeign1` char(45) NOT NULL DEFAULT '',
  `NameInForeign2` char(45) NOT NULL DEFAULT '',
  `BaseCurrency` char(3) NOT NULL,
  `Address` char(60) NOT NULL DEFAULT '',
  `Tel` char(20) NOT NULL DEFAULT '',
  `Fax` char(20) NOT NULL,
  `WebSite` char(40) NOT NULL,
  `email` char(40) NOT NULL DEFAULT '',
  `Logo` blob NOT NULL,
  `UpdateBy` char(10) NOT NULL,
  `UpdateTime` datetime NOT NULL DEFAULT '2999-01-01 00:00:00',
  PRIMARY KEY (`Code`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

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

--
-- 表的结构 `exchangerate`
--

CREATE TABLE IF NOT EXISTS `exchangerate` (
  `Type` char(1) NOT NULL,
  `Date` date NOT NULL DEFAULT '2999-01-01',
  `FromCurrency` char(3) NOT NULL,
  `ToCurrency` char(3) NOT NULL COMMENT 'FromCur X Rate=ToCur',
  `Rate` double(14,6) NOT NULL,
  PRIMARY KEY (`Type`,`Date`,`FromCurrency`,`ToCurrency`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

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

--
-- 表的结构 `inventorycurdetail`
--

CREATE TABLE IF NOT EXISTS `inventorycurdetail` (
  `CompanyCode` char(3) NOT NULL,
  `WHJNL` int(6) NOT NULL,
  `Line` smallint(3) NOT NULL DEFAULT '0',
  `Vendor` char(6) NOT NULL DEFAULT '',
  `VendorCompany` char(3) NOT NULL DEFAULT '',
  `Seq` smallint(3) NOT NULL,
  `Quantity` double(11,3) NOT NULL,
  `Currency1` char(3) NOT NULL DEFAULT '',
  `UnitCost1` double(14,6) NOT NULL DEFAULT '0.000000',
  `Currency2` char(3) NOT NULL DEFAULT '',
  `UnitCost2` double(14,6) NOT NULL DEFAULT '0.000000',
  `CustomerCode` char(6) NOT NULL DEFAULT '',
  `MustSellToCustomer` tinyint(1) NOT NULL DEFAULT '0',
  `SalesCode` char(4) NOT NULL DEFAULT '',
  `MustSellBySales` tinyint(1) NOT NULL DEFAULT '0',
  `DateCode` char(10) NOT NULL,
  `PackageID` char(15) NOT NULL DEFAULT '',
  `StockWHJnl` int(6) NOT NULL DEFAULT '0' COMMENT 'Jnl# in StckBalDetail when Out/Adjust/Re-value',
  `StockLine` smallint(6) NOT NULL DEFAULT '0' COMMENT 'Line# in StockBalDetail',
  `StockSeq` smallint(6) NOT NULL DEFAULT '0' COMMENT 'Seq# in StockBalDetail',
  `WHRowID` char(2) NOT NULL,
  `WHColumnID` char(2) NOT NULL,
  `FreeSample` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`CompanyCode`,`WHJNL`,`Line`,`Seq`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

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

--
-- 表的结构 `inventorycurheader`
--

CREATE TABLE IF NOT EXISTS `inventorycurheader` (
  `CompanyCode` char(3) NOT NULL,
  `WHJnl` int(6) NOT NULL,
  `WarehouseCode` char(4) NOT NULL,
  `Type` char(1) NOT NULL COMMENT 'I-Incoming, O-Outgoing, A-Adjustment, E-Evaluate,H-Out HoldQty,S&T:Wh transfer In&Out;U&V:unpack Out&In',
  `ProductNo` char(22) NOT NULL,
  `OrderNumber` char(8) NOT NULL DEFAULT '""',
  `BackOrder` smallint(6) NOT NULL DEFAULT '0',
  `Line` smallint(6) NOT NULL DEFAULT '0',
  `UOM` char(3) NOT NULL,
  `Currency` char(3) NOT NULL,
  `UnitPrice` double(14,6) NOT NULL,
  `BaseCurrency` char(3) NOT NULL DEFAULT '',
  `BaseUnitPrice` double(14,6) NOT NULL DEFAULT '0.000000',
  `Reason` char(3) NOT NULL,
  `Date` date NOT NULL DEFAULT '2999-01-01',
  `PrintTimes` tinyint(4) NOT NULL DEFAULT '0',
  `Remark` char(60) NOT NULL DEFAULT '',
  `AddBy` char(10) NOT NULL,
  `AddDate` datetime NOT NULL DEFAULT '2999-01-01 00:00:00',
  PRIMARY KEY (`CompanyCode`,`WHJnl`,`Line`),
  UNIQUE KEY `Product` (`CompanyCode`,`ProductNo`,`Date`,`WHJnl`,`Line`),
  UNIQUE KEY `Type` (`CompanyCode`,`Type`,`OrderNumber`,`BackOrder`,`Line`,`WHJnl`),
  UNIQUE KEY `Order` (`CompanyCode`,`OrderNumber`,`Line`,`WHJnl`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED;

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

--
-- 表的结构 `inventoryhisdetail`
--

CREATE TABLE IF NOT EXISTS `inventoryhisdetail` (
  `CompanyCode` char(3) NOT NULL,
  `WHJNL` int(6) NOT NULL,
  `Line` smallint(3) NOT NULL DEFAULT '0',
  `Vendor` char(6) NOT NULL DEFAULT '',
  `VendorCompany` char(3) NOT NULL DEFAULT '',
  `Seq` smallint(3) NOT NULL,
  `Quantity` double(11,3) NOT NULL,
  `Currency1` char(3) NOT NULL DEFAULT '',
  `UnitCost1` double(14,6) NOT NULL DEFAULT '0.000000',
  `Currency2` char(3) NOT NULL DEFAULT '',
  `UnitCost2` double(14,6) NOT NULL DEFAULT '0.000000',
  `CustomerCode` char(6) NOT NULL DEFAULT '',
  `MustSellToCustomer` tinyint(1) NOT NULL DEFAULT '0',
  `SalesCode` char(4) NOT NULL DEFAULT '',
  `MustSellBySales` tinyint(1) NOT NULL DEFAULT '0',
  `DateCode` char(10) NOT NULL,
  `PackageID` char(15) NOT NULL DEFAULT '',
  `StockWHJnl` int(6) NOT NULL DEFAULT '0' COMMENT 'Jnl# in StckBalDetail when Out/Adjust/Re-value',
  `StockLine` smallint(6) NOT NULL DEFAULT '0' COMMENT 'Line# in StockBalDetail',
  `StockSeq` smallint(6) NOT NULL DEFAULT '0' COMMENT 'Seq# in StockBalDetail',
  `WHRowID` char(2) NOT NULL,
  `WHColumnID` char(2) NOT NULL,
  `FreeSample` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`CompanyCode`,`WHJNL`,`Line`,`Seq`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

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

--
-- 表的结构 `inventoryhisheader`
--

CREATE TABLE IF NOT EXISTS `inventoryhisheader` (
  `CompanyCode` char(3) NOT NULL,
  `WHJnl` int(6) NOT NULL,
  `WarehouseCode` char(4) NOT NULL,
  `Type` char(1) NOT NULL COMMENT 'I-Incoming, O-Outgoing, A-Adjustment, E-Evaluate,H-Out HoldQty,S&T:Wh transfer In&Out;U&V:unpack Out&In',
  `ProductNo` char(22) NOT NULL,
  `OrderNumber` char(8) NOT NULL DEFAULT '""',
  `BackOrder` smallint(6) NOT NULL DEFAULT '0',
  `Line` smallint(6) NOT NULL DEFAULT '0',
  `UOM` char(3) NOT NULL,
  `Currency` char(3) NOT NULL,
  `UnitPrice` double(14,6) NOT NULL,
  `BaseCurrency` char(3) NOT NULL DEFAULT '',
  `BaseUnitPrice` double(14,6) NOT NULL DEFAULT '0.000000',
  `Reason` char(3) NOT NULL,
  `Date` date NOT NULL DEFAULT '2999-01-01',
  `PrintTimes` tinyint(4) NOT NULL DEFAULT '0',
  `Remark` char(60) NOT NULL DEFAULT '',
  `AddBy` char(10) NOT NULL,
  `AddDate` datetime NOT NULL DEFAULT '2999-01-01 00:00:00',
  PRIMARY KEY (`CompanyCode`,`WHJnl`,`Line`),
  UNIQUE KEY `Product` (`CompanyCode`,`ProductNo`,`Date`,`WHJnl`,`Line`),
  UNIQUE KEY `Type` (`CompanyCode`,`Type`,`OrderNumber`,`BackOrder`,`Line`,`WHJnl`),
  UNIQUE KEY `Order` (`CompanyCode`,`OrderNumber`,`Line`,`WHJnl`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED;

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

--
-- 表的结构 `module`
--

CREATE TABLE IF NOT EXISTS `module` (
  `ModuleCode` char(2) NOT NULL DEFAULT '',
  `ModuleName` char(30) NOT NULL DEFAULT '',
  `Available` tinyint(1) NOT NULL DEFAULT '0',
  `Alert` tinyint(1) NOT NULL DEFAULT '0',
  `ByWeek` tinyint(1) NOT NULL DEFAULT '1' COMMENT '1-By Week, 0-By Date',
  `AutoRunDate` date NOT NULL DEFAULT '2999-01-01',
  `Sunday` tinyint(1) NOT NULL DEFAULT '0',
  `Monday` tinyint(1) NOT NULL DEFAULT '0',
  `Tuesday` tinyint(1) NOT NULL DEFAULT '0',
  `Wednesday` tinyint(1) NOT NULL DEFAULT '0',
  `Thursday` tinyint(1) NOT NULL DEFAULT '0',
  `Friday` tinyint(1) NOT NULL DEFAULT '0',
  `Saturday` tinyint(1) NOT NULL DEFAULT '0',
  `AutoRunTime` time NOT NULL DEFAULT '00:00:00',
  `UpdateBy` char(10) NOT NULL DEFAULT '',
  `UpdateTime` datetime NOT NULL DEFAULT '2999-01-01 00:00:00',
  PRIMARY KEY (`ModuleCode`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

--
-- 转存表中的数据 `module`
--

INSERT INTO `module` (`ModuleCode`, `ModuleName`, `Available`, `Alert`, `ByWeek`, `AutoRunDate`, `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday`, `Friday`, `Saturday`, `AutoRunTime`, `UpdateBy`, `UpdateTime`) VALUES
('IV', '庫存管理模塊', 0, 0, 1, '2999-01-01', 1, 0, 0, 0, 0, 0, 0, '00:00:00', '', '2999-01-01 00:00:00'),
('BU', '數據庫備份模塊', 0, 0, 1, '2999-01-01', 1, 0, 0, 0, 0, 0, 0, '00:00:00', '', '2999-01-01 00:00:00');

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

--
-- 表的结构 `product`
--

CREATE TABLE IF NOT EXISTS `product` (
  `ProductNo` char(22) NOT NULL,
  `Status` char(1) NOT NULL,
  `Description` char(60) NOT NULL,
  `ProductClass` char(3) NOT NULL,
  `UOM` char(3) NOT NULL,
  `Size` char(20) NOT NULL DEFAULT '',
  `Weight` double(10,3) NOT NULL DEFAULT '0.000' COMMENT 'UOM: kg',
  `WeightUOM` char(3) NOT NULL,
  `GreenLabel` tinyint(1) NOT NULL DEFAULT '1',
  `SpecialCharacter` char(15) NOT NULL,
  `MPQ` int(11) NOT NULL DEFAULT '0' COMMENT 'Minimum Purchase Qty',
  `AlertMinQty` int(11) NOT NULL DEFAULT '0',
  `AlertMaxQty` int(11) NOT NULL DEFAULT '0',
  `PrimaryVendor` char(6) NOT NULL,
  `VendorCompany` char(3) NOT NULL,
  `VendorProductNo` char(25) NOT NULL,
  `WebSite` char(120) NOT NULL DEFAULT '',
  `AddBy` char(10) NOT NULL,
  `AddTime` datetime NOT NULL DEFAULT '2999-01-01 00:00:00',
  `UpdateBy` char(10) NOT NULL DEFAULT '',
  `UpdateTime` datetime NOT NULL DEFAULT '2999-01-01 00:00:00',
  PRIMARY KEY (`ProductNo`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

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

--
-- 表的结构 `productcomments`
--

CREATE TABLE IF NOT EXISTS `productcomments` (
  `ProductNo` char(22) NOT NULL,
  `Line` tinyint(4) NOT NULL DEFAULT '1',
  `Remark` char(40) NOT NULL,
  `PrintCode` char(1) NOT NULL COMMENT '=0:no print, 8:print in InventoryOrder, 9=print in all',
  PRIMARY KEY (`ProductNo`,`Line`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

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

--
-- 表的结构 `productsubstitute`
--

CREATE TABLE IF NOT EXISTS `productsubstitute` (
  `ProductNo` char(22) NOT NULL,
  `ProductReplacement` char(22) NOT NULL,
  `Remark` char(30) NOT NULL DEFAULT '',
  PRIMARY KEY (`ProductNo`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

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

--
-- 表的结构 `staff`
--

CREATE TABLE IF NOT EXISTS `staff` (
  `LoginName` char(10) NOT NULL,
  `StaffNumber` char(4) NOT NULL,
  `Name` char(25) NOT NULL,
  `NameInForeign` char(25) NOT NULL,
  `Identity` char(20) NOT NULL DEFAULT '',
  `Password` char(20) NOT NULL DEFAULT 'cGFzc3dvcmQ=' COMMENT 'Default:password',
  `PrimaryLocale-Language` char(2) NOT NULL DEFAULT 'en',
  `PrimaryLocale-Country` char(2) NOT NULL DEFAULT 'US',
  `Type` char(2) NOT NULL,
  `Active` tinyint(1) NOT NULL DEFAULT '1',
  `Enable` tinyint(1) NOT NULL DEFAULT '1',
  `Tel` char(20) NOT NULL DEFAULT '',
  `email` char(40) NOT NULL DEFAULT '',
  `JoinDate` date NOT NULL DEFAULT '2999-01-01',
  `LeftDate` date NOT NULL DEFAULT '2999-01-01',
  `SecurityLevel` char(1) NOT NULL,
  `Operator` tinyint(1) NOT NULL DEFAULT '0',
  `AddBy` char(10) NOT NULL,
  `AddTime` datetime NOT NULL DEFAULT '2999-01-01 00:00:00',
  `UpdateBy` char(10) NOT NULL DEFAULT '',
  `UpdateTime` datetime NOT NULL DEFAULT '2999-01-01 00:00:00',
  PRIMARY KEY (`LoginName`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

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

--
-- 表的结构 `stockbaldetail`
--

CREATE TABLE IF NOT EXISTS `stockbaldetail` (
  `ProductNo` char(22) NOT NULL,
  `CompanyCode` char(3) NOT NULL,
  `WarehouseCode` char(4) NOT NULL,
  `Vendor` char(6) NOT NULL DEFAULT '',
  `VendorCompany` char(3) NOT NULL DEFAULT '',
  `WHJnl` int(6) NOT NULL,
  `InLogLine` smallint(6) NOT NULL DEFAULT '0',
  `InLogSeq` smallint(6) NOT NULL,
  `DateCode` char(10) NOT NULL,
  `PackageID` char(15) NOT NULL DEFAULT '',
  `InQuantity` double(11,3) NOT NULL,
  `BuyForCustomer` char(6) NOT NULL,
  `MustSellToCustomer` tinyint(1) NOT NULL DEFAULT '0',
  `BuyBySales` char(4) NOT NULL,
  `MustSellBySales` tinyint(1) NOT NULL DEFAULT '0',
  `InDate` date NOT NULL DEFAULT '2999-01-01',
  `FreeQty` double(11,3) NOT NULL DEFAULT '0.000' COMMENT 'Free+Allocate+Hold+Out = InQty+AdjustQty',
  `AllocateQty` double(11,3) NOT NULL DEFAULT '0.000' COMMENT 'allocated by SalesOrders',
  `HoldQty` double(11,3) NOT NULL DEFAULT '0.000' COMMENT 'Problem Stock',
  `HoldBy` char(10) NOT NULL DEFAULT '',
  `HoldTime` datetime NOT NULL DEFAULT '2999-01-01 00:00:00',
  `AdjustQty` double(11,3) NOT NULL DEFAULT '0.000',
  `OutQuantity` double(11,3) NOT NULL DEFAULT '0.000',
  `LastSellToCustomer` char(6) NOT NULL DEFAULT '' COMMENT 'not include out HoldQty',
  `LastSellBySales` char(4) NOT NULL DEFAULT '' COMMENT 'Not inclue out HoldQty',
  `LastSellDate` date NOT NULL DEFAULT '2999-01-01' COMMENT 'Not inclue out HoldQty',
  `FreeSample` tinyint(1) NOT NULL DEFAULT '0',
  `BaseCurrency` char(3) NOT NULL,
  `BaseUnitCost` double(14,6) NOT NULL DEFAULT '0.000000',
  `OriginalCurrency` char(3) NOT NULL,
  `OriginalUnitCost` double(14,6) NOT NULL,
  `WHRow` char(2) NOT NULL DEFAULT '',
  `WHCol` char(2) NOT NULL DEFAULT '',
  `AddBy` char(10) NOT NULL,
  `AddDate` datetime NOT NULL DEFAULT '2999-01-01 00:00:00',
  PRIMARY KEY (`ProductNo`,`CompanyCode`,`WarehouseCode`,`WHJnl`,`InLogLine`,`InLogSeq`),
  UNIQUE KEY `WHJnl` (`CompanyCode`,`WHJnl`,`InLogLine`,`InLogSeq`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

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

--
-- 表的结构 `stockbalheader`
--

CREATE TABLE IF NOT EXISTS `stockbalheader` (
  `ProductNo` char(22) NOT NULL,
  `CompanyCode` char(3) NOT NULL,
  `BaseCurrency` char(3) NOT NULL,
  `AvgUnitCost` double(14,6) NOT NULL DEFAULT '0.000000',
  `Quantity` double(11,3) NOT NULL DEFAULT '0.000' COMMENT 'Qty=Free+Allocate+Hold',
  `FreeQty` double(11,3) NOT NULL DEFAULT '0.000',
  `AllocateQty` double(11,3) NOT NULL DEFAULT '0.000' COMMENT 'Allocated by Sales/Cust.',
  `HoldQty` double(11,3) NOT NULL DEFAULT '0.000' COMMENT 'Problem Stock',
  `LastOutQuantity` double(11,3) NOT NULL DEFAULT '0.000',
  `LastOutDate` date NOT NULL DEFAULT '2999-01-01' COMMENT 'not input date',
  `YTDInQty` double(12,3) NOT NULL DEFAULT '0.000',
  `YTDOutQty` double(12,3) NOT NULL DEFAULT '0.000',
  `YTDAdjustQty` double(12,3) NOT NULL DEFAULT '0.000',
  PRIMARY KEY (`ProductNo`,`CompanyCode`),
  KEY `CompanyCode` (`CompanyCode`,`BaseCurrency`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

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

--
-- 表的结构 `stockbalheaderhis`
--

CREATE TABLE IF NOT EXISTS `stockbalheaderhis` (
  `ProductNo` char(22) NOT NULL,
  `CompanyCode` char(3) NOT NULL,
  `Year` smallint(6) NOT NULL DEFAULT '0',
  `BaseCurrency` char(3) NOT NULL,
  `AvgUnitCost` double(14,6) NOT NULL DEFAULT '0.000000',
  `YTDInQty` double(12,3) NOT NULL DEFAULT '0.000',
  `YTDOutQty` double(12,3) NOT NULL DEFAULT '0.000',
  `YTDAdjustQty` double(12,3) NOT NULL DEFAULT '0.000',
  PRIMARY KEY (`ProductNo`,`CompanyCode`,`Year`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

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

--
-- 表的结构 `stockbalheadertemp`
--

CREATE TABLE IF NOT EXISTS `stockbalheadertemp` (
  `ProductNo` char(22) NOT NULL,
  `CompanyCode` char(3) NOT NULL,
  `Year` smallint(6) NOT NULL DEFAULT '0',
  `BaseCurrency` char(3) NOT NULL,
  `AvgUnitCost` double(14,6) NOT NULL DEFAULT '0.000000',
  `YTDInQty` double(12,3) NOT NULL DEFAULT '0.000',
  `YTDOutQty` double(12,3) NOT NULL DEFAULT '0.000',
  `YTDAdjustQty` double(12,3) NOT NULL DEFAULT '0.000'
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

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

--
-- 表的结构 `suspendorderdetail`
--

CREATE TABLE IF NOT EXISTS `suspendorderdetail` (
  `CompanyCode` char(3) NOT NULL,
  `SuspendNumber` int(11) NOT NULL,
  `Line` smallint(6) NOT NULL DEFAULT '0',
  `ProductNo` char(22) NOT NULL,
  `UOM` char(3) NOT NULL,
  `UnitPrice` double(14,6) NOT NULL,
  `Quantity` double(11,3) NOT NULL,
  `Datecode` char(10) NOT NULL,
  PRIMARY KEY (`CompanyCode`,`SuspendNumber`,`Line`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED;

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

--
-- 表的结构 `suspendorderheader`
--

CREATE TABLE IF NOT EXISTS `suspendorderheader` (
  `CompanyCode` char(3) NOT NULL,
  `SuspendNumber` int(11) NOT NULL,
  `OrderNumber` char(8) NOT NULL DEFAULT '',
  `BackOrder` smallint(6) NOT NULL DEFAULT '0',
  `WarehouseCode` char(4) NOT NULL,
  `Type` char(1) NOT NULL COMMENT 'I-Incoming, O-Outgoing, A-Adjustment, E-Evaluate',
  `AccountID` char(6) NOT NULL,
  `SalesCode` char(4) NOT NULL,
  `Currency` char(3) NOT NULL,
  `Reason` char(3) NOT NULL,
  `Date` date NOT NULL DEFAULT '2999-01-01',
  `Remark` char(60) NOT NULL DEFAULT '',
  `UpdateBy` char(10) NOT NULL,
  `UpdateTime` datetime NOT NULL,
  PRIMARY KEY (`CompanyCode`,`SuspendNumber`),
  UNIQUE KEY `CompanyCode` (`CompanyCode`,`Type`,`OrderNumber`,`BackOrder`,`SuspendNumber`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED;

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

--
-- 表的结构 `system`
--

CREATE TABLE IF NOT EXISTS `system` (
  `DefaultLocale-Language` char(2) NOT NULL DEFAULT 'en',
  `DefaultLocale-Country` char(2) NOT NULL DEFAULT 'US',
  `PrimaryCompany` char(3) NOT NULL DEFAULT '',
  `Registrant` char(190) NOT NULL DEFAULT '',
  `MinPasswordLength` int(11) NOT NULL DEFAULT '6',
  `LoginAttemps` int(11) NOT NULL DEFAULT '5' COMMENT '0:no limit; max:10 times',
  `AllowPrintScreen` tinyint(1) NOT NULL DEFAULT '1',
  `AccessByMenuOption` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'By MenuOptions or SecurityLevel+Operator',
  `AdminLoginName` char(10) NOT NULL DEFAULT '',
  `BackupCmdPath` char(80) NOT NULL DEFAULT '',
  `AlertEmailSender` varchar(40) NOT NULL DEFAULT '',
  `EmailPassword` char(20) NOT NULL DEFAULT '',
  `smtpServer` char(40) NOT NULL DEFAULT '',
  `Port` int(11) NOT NULL DEFAULT '25',
  `CheckPeriod` int(11) NOT NULL DEFAULT '60' COMMENT 'For Service checking run time',
  `CheckSum` char(60) NOT NULL DEFAULT '',
  `UpdateBy` char(10) NOT NULL,
  `UpdateTime` datetime NOT NULL DEFAULT '2999-01-01 00:00:00',
  PRIMARY KEY (`DefaultLocale-Language`,`DefaultLocale-Country`,`PrimaryCompany`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

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

--
-- 表的结构 `typelist`
--

CREATE TABLE IF NOT EXISTS `typelist` (
  `Category` char(10) NOT NULL,
  `Type` char(3) NOT NULL,
  `Description` char(40) NOT NULL,
  PRIMARY KEY (`Category`,`Type`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

--
-- 转存表中的数据 `typelist`
--

INSERT INTO `typelist` (`Category`, `Type`, `Description`) VALUES
('AcctStatus', 'A', '可用'),
('AcctStatus', 'I', '停用'),
('AcctStatus', 'L', '法律行動中'),
('AcctStatus', 'S', '暫時停用'),
('Country', 'CN', '中國'),
('Country', 'HK', '香港'),
('Country', 'JP', '日本'),
('Country', 'TW', '臺灣'),
('Country', 'UK', '英國'),
('Country', 'US', '美國'),
('Currency', 'CNY', '人民幣'),
('Currency', 'EUR', '歐羅'),
('Currency', 'GBP', '英鎊'),
('Currency', 'HKD', '港元'),
('Currency', 'JPY', '日元'),
('Currency', 'TWD', '台幣'),
('Currency', 'USD', '美元'),
('ExRateType', 'D', '進銷存系統'),
('InvAReason', '001', '多收貨'),
('InvAReason', '002', '少收貨'),
('InvAReason', '003', '免費樣品收貨'),
('InvAReason', '004', '客戶退貨 - 好貨'),
('InvAReason', '005', '客戶退貨 - 壞貨'),
('InvAReason', '006', '庫存註銷'),
('InvAReason', '007', '點倉後數量調整'),
('InvAReason', '999', '其他'),
('InvEReason', '001', '將運費加進庫存成本'),
('InvEReason', '002', '折舊-由金額'),
('InvEReason', '003', '折舊-由百分比'),
('InvEReason', '999', '其他'),
('InvIReason', '001', '正常收貨'),
('InvIReason', '002', '客戶退貨 - 好貨'),
('InvIReason', '003', '客戶退貨 - 壞貨'),
('InvIReason', '999', '其他'),
('InvOReason', '001', '正常出貨'),
('InvOReason', '002', '免費樣品出貨'),
('InvOReason', '003', '退貨給供應商'),
('InvOReason', '999', '其他'),
('InvTReason', '001', '貨物轉倉'),
('InvTReason', '002', '貨物搬位（同倉）'),
('InvTReason', '999', '其他'),
('InvUReason', '001', '銷售用'),
('InvUReason', '002', '損壞'),
('InvUReason', '999', '其他'),
('Inv_Type', 'A', '庫存數量調整'),
('Inv_Type', 'E', '庫存成本調整'),
('Inv_Type', 'H', '問題貨物出貨'),
('Inv_Type', 'I', '進貨'),
('Inv_Type', 'O', '出貨'),
('Inv_Type', 'S', '轉倉轉入'),
('Inv_Type', 'T', '轉倉轉出'),
('Inv_Type', 'U', '拆箱轉出'),
('Inv_Type', 'V', '拆箱轉入'),
('PrintCode', '0', '不打印'),
('PrintCode', '3', '在所有倉單上打印'),
('PrintCode', '9', '在所有的地方都打印'),
('ProdClass', 'E01', '産品種類1'),
('ProdStatus', 'A', '可用'),
('ProdStatus', 'I', '停用'),
('SecuLevel', '0', '系統管理員'),
('SecuLevel', '1', '集團'),
('SecuLevel', '2', '公司'),
('SecuLevel', '3', '部門'),
('SecuLevel', '4', '員工'),
('StaffType', 'AM', '管理部門'),
('StaffType', 'PC', '採購員'),
('StaffType', 'SC', '銷售員'),
('UOM', 'BOX', '箱'),
('UOM', 'G', '克'),
('UOM', 'KG', '千克'),
('UOM', 'KPC', '千片'),
('UOM', 'PC', '片'),
('UOM', 'TIN', '罐/聽'),
('UOM', 'TON', '吨'),
('WeightUOM', 'G', '克'),
('WeightUOM', 'KG', '千克'),
('WeightUOM', 'TON', '噸');

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

--
-- 表的结构 `typelistlength`
--

CREATE TABLE IF NOT EXISTS `typelistlength` (
  `Category` char(10) NOT NULL,
  `Length` smallint(1) NOT NULL DEFAULT '3',
  `System` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`Category`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

--
-- 转存表中的数据 `typelistlength`
--

INSERT INTO `typelistlength` (`Category`, `Length`, `System`) VALUES
('AcctStatus', 1, 1),
('Country', 3, 1),
('Currency', 3, 1),
('InvIReason', 3, 1),
('Inv_Type', 1, 1),
('ProdClass', 3, 1),
('SecuLevel', 1, 1),
('StaffType', 2, 1),
('UOM', 3, 1),
('ProdStatus', 1, 1),
('WeightUOM', 3, 1),
('PrintCode', 1, 1),
('InvAReason', 3, 1),
('InvOReason', 3, 1),
('ExRateType', 1, 1),
('InvEReason', 3, 1),
('InvTReason', 3, 1),
('InvUReason', 3, 1);

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

--
-- 表的结构 `warehouse`
--

CREATE TABLE IF NOT EXISTS `warehouse` (
  `WarehouseCode` char(4) NOT NULL,
  `Active` tinyint(1) NOT NULL DEFAULT '1',
  `Name` char(40) NOT NULL,
  `Manager` char(30) NOT NULL DEFAULT '',
  `Address` char(60) NOT NULL,
  `City` char(15) NOT NULL,
  `Province` char(20) NOT NULL,
  `Country` char(3) NOT NULL,
  `Tel` char(20) NOT NULL,
  `Fax` char(20) NOT NULL,
  `email` char(40) NOT NULL,
  `UpdateBy` char(10) NOT NULL,
  `UpdateTime` datetime NOT NULL,
  PRIMARY KEY (`Name`,`WarehouseCode`),
  UNIQUE KEY `WarehouseCode` (`WarehouseCode`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

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

--
-- 表的结构 `warehousechamber`
--

CREATE TABLE IF NOT EXISTS `warehousechamber` (
  `WarehouseCode` char(4) NOT NULL,
  `Row` char(2) NOT NULL,
  `ColForRow` char(2) NOT NULL,
  `Description` char(30) NOT NULL DEFAULT '',
  PRIMARY KEY (`WarehouseCode`,`Row`,`ColForRow`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

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