-- phpMyAdmin SQL Dump
-- version 3.4.9
-- http://www.phpmyadmin.net
--
-- 主机: localhost
-- 生成日期: 2012 年 04 月 06 日 15:28
-- 服务器版本: 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 */;

--
-- 数据库: `dcinv104eni`
--

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

--
-- 表的结构 `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_Rev_AutoOrd', 'RV', 'TextPrefix', 1, '', 'Cost Revaluation Order AutoNumbering', '', '0000-00-00 00:00:00'),
('', 'Inv_Out_AutoOrd', 'SI', 'TextPrefix', 1, '', 'Delivery Order AutoNumbering', '', '0000-00-00 00:00:00'),
('', 'Inv_Need_Cust', '', '', 0, 'Account', 'Must Input Customer# for goods receiving', '', '0000-00-00 00:00:00'),
('', 'Inv_Need_Sales', 'SC', 'StaffType', 0, 'Staff', 'Must Input Salescode when goods receive', '', '0000-00-00 00:00:00'),
('', 'Inv_Need_WHLoca', '', '', 1, 'WarehouseChamber', 'Must input W/H Location when receiving', '', '0000-00-00 00:00:00'),
('', 'Inv_Upk_AutoOrd', 'UP', 'TextPrefix', 1, '', 'Product Unpacking Order AutoNumbering', '', '0000-00-00 00:00:00'),
('', 'Inv_Adj_AutoOrd', 'AJ', 'TextPrefix', 1, '', 'Quantity Adjustment Order AutoNumbering', '', '0000-00-00 00:00:00'),
('', 'InvIn_I_AutoOrd', 'PI', 'TextPrefix', 1, '', 'Storage Order AutoNumbering', '', '0000-00-00 00:00:00'),
('', 'Inv_Trf_AutoOrd', 'TF', 'TextPrefix', 1, '', 'WH Transfer Order AutoNumbering', '', '0000-00-00 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', 'Inventory Module', 0, 0, 1, '2999-01-01', 1, 0, 0, 0, 0, 0, 0, '00:00:00', '', '2999-01-01 00:00:00'),
('BU', 'DB Backup Module', 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', 'Active'),
('AcctStatus', 'I', 'Inactive'),
('AcctStatus', 'L', 'Legal Processing'),
('AcctStatus', 'S', 'Suspended'),
('Country', 'CN', 'China'),
('Country', 'HK', 'Hong Kong'),
('Country', 'JP', 'Japan'),
('Country', 'TW', 'Taiwan'),
('Country', 'UK', 'U.K.'),
('Country', 'US', 'United States'),
('Currency', 'CNY', 'PR China Ren Min Bi'),
('Currency', 'EUR', 'Euro'),
('Currency', 'GBP', 'UK Pound'),
('Currency', 'HKD', 'Hong Kong Dollar'),
('Currency', 'JPY', 'Japan Yen'),
('Currency', 'TWD', 'Tai Wan Dollar'),
('Currency', 'USD', 'U.S. Dollar'),
('ExRateType', 'D', 'Distributing System'),
('InvAReason', '001', 'Over Receiving'),
('InvAReason', '002', 'Shortage in Receiving'),
('InvAReason', '003', 'Free Sample Receiving'),
('InvAReason', '004', 'Goods Return  - Resell'),
('InvAReason', '005', 'Goods Return - Damaged'),
('InvAReason', '006', 'Write Off'),
('InvAReason', '007', 'Qty-Adjust. after Stock-take'),
('InvAReason', '999', 'Other'),
('InvEReason', '001', 'Adding Shipping Cost'),
('InvEReason', '002', 'Depreciation by Amount'),
('InvEReason', '003', 'Depreciation by Percentage'),
('InvEReason', '999', 'Other'),
('InvIReason', '001', 'Goods Normal Receving'),
('InvIReason', '002', 'Goods Return - Resell'),
('InvIReason', '003', 'Goods Return - Damaged'),
('InvIReason', '999', 'Other'),
('InvOReason', '001', 'Normal Delivery'),
('InvOReason', '002', 'Deliver Free Sample'),
('InvOReason', '003', 'Return Goods to supplier.'),
('InvOReason', '999', 'Other'),
('InvTReason', '001', 'Goods Transfer'),
('InvTReason', '002', 'Goods Moving (within a warehouse)'),
('InvTReason', '999', 'Other'),
('InvUReason', '001', 'For Sales'),
('InvUReason', '002', 'Damaged'),
('InvUReason', '999', 'Other'),
('Inv_Type', 'A', 'Quantity Adjustment'),
('Inv_Type', 'E', 'Cost Revaluation'),
('Inv_Type', 'H', 'Problem Qty Delivery'),
('Inv_Type', 'I', 'Goods Receiving'),
('Inv_Type', 'O', 'Goods Delivery'),
('Inv_Type', 'S', 'WH Transfer/Move In'),
('Inv_Type', 'T', 'WH Transfer/Move Out'),
('Inv_Type', 'U', 'Unpacking Move Out'),
('Inv_Type', 'V', 'Unpacking Move In'),
('PrintCode', '0', 'Not Print'),
('PrintCode', '3', 'Print on all types of Inventory Orders'),
('PrintCode', '9', 'Print everywhere'),
('ProdClass', 'E01', 'product class 1'),
('ProdStatus', 'A', 'Active'),
('ProdStatus', 'I', 'Inactive'),
('SecuLevel', '0', 'System Administrator'),
('SecuLevel', '1', 'Companies'),
('SecuLevel', '2', 'Company'),
('SecuLevel', '3', 'Department'),
('SecuLevel', '4', 'Staff'),
('StaffType', 'AM', 'Internal Fair Administrator'),
('StaffType', 'PC', 'Purchase Person'),
('StaffType', 'SC', 'Sales Persons'),
('UOM', 'BOX', 'Box'),
('UOM', 'G', 'Gram'),
('UOM', 'KG', 'Kilogram'),
('UOM', 'KPC', 'Kilo PCs'),
('UOM', 'PC', 'Pieces'),
('UOM', 'TIN', 'Tin'),
('UOM', 'TON', 'Ton'),
('WeightUOM', 'G', 'Gram'),
('WeightUOM', 'KG', 'Kilogram'),
('WeightUOM', 'TON', '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 */;
