/**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_SALORDERRPENTRY' AND KSQL_COL_NAME ='FUNREMAINAMOUNT') 
 ALTER TABLE T_SM_SALORDERRPENTRY ADD (FUNREMAINAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SM_XSALORDERRPENTRY' AND KSQL_COL_NAME ='FUNREMAINAMOUNT') 
 ALTER TABLE T_SM_XSALORDERRPENTRY ADD (FUNREMAINAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SM_SOMATCH') 
 CREATE TABLE T_SM_SOMATCH (
FID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FWFNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FWFSEQ NVARCHAR(80) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FBILLSTATUS VARCHAR(5) DEFAULT ' ' NOT NULL,
FWRITEOFFTYPEID BIGINT DEFAULT 0 NOT NULL,
FHEADWFINFO NVARCHAR(512),
FHEADWFINFO_TAG NCLOB
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SM_SOMATCHENTRY') 
 CREATE TABLE T_SM_SOMATCHENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FBILLTYPE NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBIZDATE DATETIME,
FCUSTOMERID BIGINT DEFAULT 0 NOT NULL,
FCURRENCYID BIGINT DEFAULT 0 NOT NULL,
FBILLENTRYID BIGINT DEFAULT 0 NOT NULL,
FENTRYSEQ BIGINT DEFAULT 0 NOT NULL,
FAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMAINWFINFO NVARCHAR(512),
FMAINWFINFO_TAG NCLOB,
FASSBILLTYPE NVARCHAR(80) DEFAULT ' ' NOT NULL,
FASSBILLID BIGINT DEFAULT 0 NOT NULL,
FASSBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FASSBIZDATE DATETIME,
FASSCURRENCYID BIGINT DEFAULT 0 NOT NULL,
FASSBILLENTRYID BIGINT DEFAULT 0 NOT NULL,
FASSENTRYSEQ BIGINT DEFAULT 0 NOT NULL,
FASSAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSWFINFO NVARCHAR(512),
FASSWFINFO_TAG NCLOB
);



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