/**Begin D:\PDM_UPGRADE\PDM1\PUR_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_EXAMINE') 
 CREATE TABLE T_PUR_EXAMINE (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FBILLDATE DATETIME,
FORGID BIGINT DEFAULT 0 NOT NULL,
FBIZTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FEXAMTYPEID BIGINT DEFAULT 0 NOT NULL,
FEXAMINERID BIGINT DEFAULT 0 NOT NULL,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FCURRID BIGINT DEFAULT 0 NOT NULL,
FDESCRIPTION NVARCHAR(510) DEFAULT ' ',
FBILLSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCFMSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FAUDITSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FBIZPARTNERID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_EXAMINE_A') 
 CREATE TABLE T_PUR_EXAMINE_A (
FID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FCFMID BIGINT DEFAULT 0 NOT NULL,
FCFMDATE DATETIME,
FORIGIN CHAR(1) DEFAULT ' ' NOT NULL,
FCFMOPINION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FAUDITOPINION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FAPPROVERID BIGINT DEFAULT 0 NOT NULL,
FAPPROVEDATE DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_EXAMINE_L') 
 CREATE TABLE T_PUR_EXAMINE_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_IMPROVE') 
 CREATE TABLE T_PUR_IMPROVE (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FBILLDATE DATETIME,
FORGID BIGINT DEFAULT 0 NOT NULL,
FLINKMANID BIGINT DEFAULT 0 NOT NULL,
FBIZTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FIMPROVETYPEID BIGINT DEFAULT 0 NOT NULL,
FSUBJECT NVARCHAR(255) DEFAULT ' ' NOT NULL,
FREPLYDATE DATETIME,
FENDDATE DATETIME,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FDESCRIPTION NVARCHAR(510) DEFAULT ' ',
FQUALITY NVARCHAR(510) DEFAULT ' ',
FSERVICE NVARCHAR(510) DEFAULT ' ',
FOTHER NVARCHAR(510) DEFAULT ' ',
FSUPQUALITY NVARCHAR(510) DEFAULT ' ',
FSUPSERVICE NVARCHAR(510) DEFAULT ' ',
FSUPOTHER NVARCHAR(510) DEFAULT ' ',
FSUPREPLY NVARCHAR(510) DEFAULT ' ',
FBILLSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCFMSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FAUDITSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FBIZPARTNERID BIGINT DEFAULT 0 NOT NULL,
FExpectDate DATETIME,
FFinishStatus CHAR(1) DEFAULT ' ' NOT NULL,
FFinishDate DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_IMPROVE_A') 
 CREATE TABLE T_PUR_IMPROVE_A (
FID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FCFMID BIGINT DEFAULT 0 NOT NULL,
FCFMDATE DATETIME,
FCFMOPINION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FAUDITOPINION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FHANDLERID BIGINT DEFAULT 0 NOT NULL,
FHANDLEDATE DATETIME,
FORIGIN CHAR(1) DEFAULT ' ' NOT NULL,
FAPPROVERID BIGINT DEFAULT 0 NOT NULL,
FAPPROVEDATE DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_IMPROVE_L') 
 CREATE TABLE T_PUR_IMPROVE_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_QUALITY') 
 CREATE TABLE T_PUR_QUALITY (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FBILLDATE DATETIME,
FORGID BIGINT DEFAULT 0 NOT NULL,
FBIZTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FCHGTYPEID BIGINT DEFAULT 0 NOT NULL,
FSUBJECT NVARCHAR(255) DEFAULT ' ' NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FCATEGORYID BIGINT DEFAULT 0 NOT NULL,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FBILLSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCFMSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FBIZPARTNERID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_QUALITY_A') 
 CREATE TABLE T_PUR_QUALITY_A (
FID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FCFMID BIGINT DEFAULT 0 NOT NULL,
FCFMDATE DATETIME,
FCFMOPINION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FORIGIN CHAR(1) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_QUALITY_EQUIP') 
 CREATE TABLE T_PUR_QUALITY_EQUIP (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FNOTE NVARCHAR(100) DEFAULT ' ' NOT NULL,
FEQUIP1 NVARCHAR(100) DEFAULT ' ' NOT NULL,
FEQUIP5 NVARCHAR(100) DEFAULT ' ' NOT NULL,
FEQUIP2 NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSUPPLIER2 NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSUPPLIER3 NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSUPPLIER1 NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSUPPLIER4 NVARCHAR(100) DEFAULT ' ' NOT NULL,
FEQUIP3 NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSUPPLIER5 NVARCHAR(100) DEFAULT ' ' NOT NULL,
FEQUIP4 NVARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_QUALITY_L') 
 CREATE TABLE T_PUR_QUALITY_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_QUALITY_LINK') 
 CREATE TABLE T_PUR_QUALITY_LINK (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FGENDER CHAR(1) DEFAULT ' ' NOT NULL,
FDEPT NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDUTY NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBIZSCOPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FPHONE VARCHAR(50) DEFAULT ' ' NOT NULL,
FMOBILE VARCHAR(50) DEFAULT ' ' NOT NULL,
FEMAIL VARCHAR(50) DEFAULT ' ' NOT NULL,
FFAX VARCHAR(50) DEFAULT ' ' NOT NULL,
FPOST VARCHAR(10) DEFAULT ' ' NOT NULL,
FADDRESS NVARCHAR(100) DEFAULT ' ' NOT NULL,
FNOTE NVARCHAR(255) DEFAULT ' ' NOT NULL,
FISDEFAULT CHAR(1) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_QUALITY_MANAGE') 
 CREATE TABLE T_PUR_QUALITY_MANAGE (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FTYPEID BIGINT DEFAULT 0 NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FAUDITORG NVARCHAR(100) DEFAULT ' ' NOT NULL,
FAUDITDATE DATETIME,
FDATETO DATETIME,
FNOTE NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_QUALITY_MAT') 
 CREATE TABLE T_PUR_QUALITY_MAT (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FMODEL NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSUPMODEL_NEW NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSUPNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSUPMODEL NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSUPNAME_NEW NVARCHAR(100) DEFAULT ' ' NOT NULL,
FNOTE NVARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_QUALITY_PACK') 
 CREATE TABLE T_PUR_QUALITY_PACK (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FNOTE NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_QUALITY_SHIP') 
 CREATE TABLE T_PUR_QUALITY_SHIP (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FNOTE NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_QUALITY_STORE') 
 CREATE TABLE T_PUR_QUALITY_STORE (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FNOTE NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_QUALITY_TECH') 
 CREATE TABLE T_PUR_QUALITY_TECH (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FPROCESS NVARCHAR(50) DEFAULT ' ' NOT NULL,
FNOTE NVARCHAR(255) DEFAULT ' ' NOT NULL
);



/**End D:\PDM_UPGRADE\PDM1\PUR_table.sql **/
