/**Begin C:\PDM_UPGRADE\PDM1\SRM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_AUDITENTRY' AND KSQL_COL_NAME IN ('FINSPECTRESULT')) 
 ALTER TABLE T_PUR_AUDITENTRY ADD (FINSPECTRESULT CHAR(1) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_AUDITENTRY' AND KSQL_COL_NAME IN ('FINSPECTNOTE')) 
 ALTER TABLE T_PUR_AUDITENTRY ADD (FINSPECTNOTE NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRM_MOBILEINSPECT') 
 CREATE TABLE T_SRM_MOBILEINSPECT (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO VARCHAR(50) DEFAULT ' ' NOT NULL,
FBILLSTATUS CHAR(1) DEFAULT 'A' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FJUDGERID BIGINT DEFAULT 0 NOT NULL,
FSCENENOID BIGINT DEFAULT 0 NOT NULL,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FBILLDATE DATETIME,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FAUDITDATE DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRM_AUDITENTRYATT') 
 CREATE TABLE T_SRM_AUDITENTRYATT (
FPKID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRM_INSPECTENTRY') 
 CREATE TABLE T_SRM_INSPECTENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FINSPECTPROJECT BIGINT DEFAULT 0 NOT NULL,
FINSPECTSCORE DECIMAL(23,2) DEFAULT 0 NOT NULL,
FINSPECTRESULT CHAR(1) DEFAULT ' ' NOT NULL,
FINSPECTNOTE NVARCHAR(255) DEFAULT ' ' NOT NULL,
FINSPECTSTATUS CHAR(1) DEFAULT 'A' NOT NULL,
FLONGITUDE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLATITUDE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCATION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


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



/**End C:\PDM_UPGRADE\PDM1\SRM_table.sql **/
