/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\HDM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HDM_TRANSFERBILL_B' AND KSQL_COL_NAME ='FTRANSFERTYPEID') 
 ALTER TABLE T_HDM_TRANSFERBILL_B ADD (FTRANSFERTYPEID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HDM_DOCUMENTORG') 
 CREATE TABLE T_HDM_DOCUMENTORG (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID VARCHAR(60) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HDM_TRANSFERBATCH') 
 CREATE TABLE T_HDM_TRANSFERBATCH (
FMID BIGINT DEFAULT 0 NOT NULL,
FBILLNO VARCHAR(60) DEFAULT ' ' NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FAFFILIATIONORDID 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,
FISEXISTSWORKFLOW CHAR(1) DEFAULT ' ' NOT NULL,
FISSUBMIT CHAR(1) DEFAULT ' ' NOT NULL,
FBARCODE VARCHAR(60) DEFAULT ' ' NOT NULL,
FINPUTDEVICETYPE VARCHAR(100) DEFAULT ' ' NOT NULL,
FEVENTEFFECTDATE DATETIME,
FBILLSTATUS VARCHAR(2) DEFAULT ' ' NOT NULL,
FAUDITSTATUS VARCHAR(2) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FDOCUMENTNO NVARCHAR(500) DEFAULT ' ' NOT NULL,
FDOCUMENTNAME NVARCHAR(500) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HDM_TRANSFERBATCH_L') 
 CREATE TABLE T_HDM_TRANSFERBATCH_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FDOCUMENTNO NVARCHAR(500) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FDOCUMENTNAME NVARCHAR(500) DEFAULT ' ' NOT NULL
);



/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\HDM_table.sql **/
