/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\SM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SM_XSALORDERENTRY_R' AND KSQL_COL_NAME ='FENTRUSTVERIFYQTY') 
 ALTER TABLE T_SM_XSALORDERENTRY_R ADD (FENTRUSTVERIFYQTY DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SM_XSALORDERENTRY_R' AND KSQL_COL_NAME ='FENTRUSTVERIFYBASEQTY') 
 ALTER TABLE T_SM_XSALORDERENTRY_R ADD (FENTRUSTVERIFYBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SM_WFRECORD') 
 CREATE TABLE T_SM_WFRECORD (
FID BIGINT DEFAULT 0 NOT NULL,
FWFNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FWFSEQ NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLSTATUS VARCHAR(5) DEFAULT ' ' NOT NULL,
FWRITEOFFTYPEID BIGINT DEFAULT 0 NOT NULL,
FHEADWFINFO_TAG NCLOB,
FHEADWFINFO NVARCHAR(512),
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SM_WFRECORDENTRY') 
 CREATE TABLE T_SM_WFRECORDENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FBILLTYPEID NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBIZTYPEID BIGINT DEFAULT 0 NOT NULL,
FBIZDATE DATETIME,
FBILLID BIGINT DEFAULT 0 NOT NULL,
FBILLENTRYID BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FBILLQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FVERIFYQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBASEUNITID BIGINT DEFAULT 0 NOT NULL,
FVERIFYBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FISPRESENT CHAR(1) DEFAULT '0' NOT NULL,
FWFINFO_TAG NCLOB,
FWFINFO NVARCHAR(512)
);



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