/**Begin D:\d_desk\pdm\PDM_UPGRADE_1.1\PDM_UPGRADE\pdm1\SIM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SIM_DECLARATION_RECORD') 
 CREATE TABLE T_SIM_DECLARATION_RECORD (
FID BIGINT DEFAULT 0 NOT NULL,
FBATCHNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCOLLECTORG BIGINT DEFAULT 0 NOT NULL,
FCOLLECTOR BIGINT DEFAULT 0 NOT NULL,
FSUCCESSNUM BIGINT DEFAULT 0 NOT NULL,
FFAILNUM BIGINT DEFAULT 0 NOT NULL,
FCOLLECTSTATUS NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCOLLECTTRACEID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCOLLECTDATE DATETIME,
FORG BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SIM_DECLARATION_BILL') 
 CREATE TABLE T_SIM_DECLARATION_BILL (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(30) DEFAULT ' ' NOT NULL,
FBILLSTATUS NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FMODIFYTIME DATETIME,
FCREATETIME DATETIME,
FORGID BIGINT DEFAULT 0 NOT NULL,
FENTRYID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCONSIGNORCNAME NVARCHAR(150) DEFAULT ' ' NOT NULL,
FCNSNTRADESCC NVARCHAR(50) DEFAULT ' ' NOT NULL,
FOWNERNAME NVARCHAR(150) DEFAULT ' ' NOT NULL,
FOWNERSCC NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCONSIGNEEENAME NVARCHAR(150) DEFAULT ' ' NOT NULL,
FDDATE DATETIME,
FIEPORTNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCUSTRAFMODENAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FTRANSPORTINFO NVARCHAR(150) DEFAULT ' ' NOT NULL,
FSUPVMODECDDENAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCUTMODENAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCONTRACTNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCURTRADENATIONCODENAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCUSTRADECOUNTRYNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDISTINATEPORTNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDESPPORTCODENAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FWRAPTYPENAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FATTADOCUCDSTR NVARCHAR(150) DEFAULT ' ' NOT NULL,
FMARKNO NVARCHAR(150) DEFAULT ' ' NOT NULL,
FPACKNO DECIMAL(23,10) DEFAULT 0 NOT NULL,
FGROSSWT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FNETWT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCLEARANCESTATUS NVARCHAR(50) DEFAULT ' ' NOT NULL,
FPUSHSTATUS NVARCHAR(50) DEFAULT ' ' NOT NULL,
FTRANSMODENAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FTRADECURR BIGINT DEFAULT 0 NOT NULL,
FDEALEXCHANGERATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDEALTOTALFROMAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDEALTOTALAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FISSUETOTALAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FLOCALCURRENCY BIGINT DEFAULT 0 NOT NULL,
FFEECURR BIGINT DEFAULT 0 NOT NULL,
FFEEEXCHANGERATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FFEEMARK NVARCHAR(50) DEFAULT ' ' NOT NULL,
FPREMIUM DECIMAL(23,10) DEFAULT 0 NOT NULL,
FINSURLOCALAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FOTHERCURR BIGINT DEFAULT 0 NOT NULL,
FOTHEREXCHANGERATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FOTHERMARK NVARCHAR(50) DEFAULT ' ' NOT NULL,
FOTHERRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FOTHERLOCALAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBATCHNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FIEDATE DATETIME,
FFEERATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FFEEAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FINSURCURR BIGINT DEFAULT 0 NOT NULL,
FINSUREXCHANGERATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FINSURMARK NVARCHAR(50) DEFAULT ' ' NOT NULL,
FISSUEWAY NVARCHAR(50) DEFAULT ' ' NOT NULL,
FISSUERULE BIGINT DEFAULT 0 NOT NULL,
FCOLLECTSTATUS NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SIM_DECLARATION_ITEMS') 
 CREATE TABLE T_SIM_DECLARATION_ITEMS (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FGOODSID BIGINT DEFAULT 0 NOT NULL,
FGNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FGMODEL NVARCHAR(50) DEFAULT ' ' NOT NULL,
FQTY1 DECIMAL(23,10) DEFAULT 0 NOT NULL,
FUNIT1NAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FGQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FGUNITNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FQTY2 DECIMAL(23,10) DEFAULT 0 NOT NULL,
FUNIT2NAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDECLPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDEALLOCALPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDECLTOTAL DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDEALLOCALAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FISSUEPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FISSUEAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FGOODSCODE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FTAXRATE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCODETS NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDEDUCTAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXRATECODEID BIGINT DEFAULT 0 NOT NULL,
FISSUENUM DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPOLICYLOGO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FPOLICYCONTANTS NVARCHAR(50) DEFAULT ' ' NOT NULL
);



/**End D:\d_desk\pdm\PDM_UPGRADE_1.1\PDM_UPGRADE\pdm1\SIM_table.sql **/
