/**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_DELIVERNOTICE_F' AND KSQL_COL_NAME ='FPAYMODE') 
 ALTER TABLE T_SM_DELIVERNOTICE_F ADD (FPAYMODE VARCHAR(30) DEFAULT 'CREDIT' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SM_RETURNAPPLY_F' AND KSQL_COL_NAME ='FPAYMODE') 
 ALTER TABLE T_SM_RETURNAPPLY_F ADD (FPAYMODE VARCHAR(30) DEFAULT 'CREDIT' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SM_SALORDER_F' AND KSQL_COL_NAME ='FPAYMODE') 
 ALTER TABLE T_SM_SALORDER_F ADD (FPAYMODE VARCHAR(30) DEFAULT 'CREDIT' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SM_XSALORDER_F' AND KSQL_COL_NAME ='FPAYMODE') 
 ALTER TABLE T_SM_XSALORDER_F ADD (FPAYMODE VARCHAR(30) DEFAULT 'CREDIT' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SM_LOGISTICSINFO') 
 CREATE TABLE T_SM_LOGISTICSINFO (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SM_LOGISTICSINFOENTRY') 
 CREATE TABLE T_SM_LOGISTICSINFOENTRY (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FLOGISTICSCOMPID BIGINT DEFAULT 0 NOT NULL,
FLOGISTICSNUM NVARCHAR(80) DEFAULT ' ' NOT NULL,
FRECEIVEPHONE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSENDERPHONE NVARCHAR(50) DEFAULT ' ' NOT NULL
);


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