/**Begin 对公报销单相关物理表创建 **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_ER_PUBREIMACCINFO')
 CREATE TABLE T_ER_PUBREIMACCINFO (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FPAYMODEID BIGINT DEFAULT 0 NOT NULL,
FPAYERID BIGINT DEFAULT 0 NOT NULL,
FPAYERNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FPAYERBANKID BIGINT DEFAULT 0 NOT NULL,
FPAYERACCOUNT02 VARCHAR(100) DEFAULT ' ' NOT NULL,
FPAYERACCOUNT VARCHAR(100) DEFAULT ' ' NOT NULL,
FACCOUNTCURRENCY BIGINT DEFAULT 0 NOT NULL,
FEXCHANGERATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FORIAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPAYERACCOUNT01 VARCHAR(100) DEFAULT ' ' NOT NULL,
FBANKLOGO VARCHAR(50) DEFAULT ' ' NOT NULL,
FENTRYREPAYDATE DATETIME,
FACCBALANCEAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FORIACCBALANCEAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FORIACCNOTPAYAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FACCNOTPAYAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FBUILDEDAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUPPLIER BIGINT DEFAULT 0 NOT NULL,
FCUSTOMER BIGINT DEFAULT 0 NOT NULL,
FCASORG BIGINT DEFAULT 0 NOT NULL,
FPAYERTYPE VARCHAR(30) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_ER_PUBREIMBILL_L')
 CREATE TABLE T_ER_PUBREIMBILL_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FAPPLIERPOSITIONSTR VARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_ER_PUBREIMEXPDET')
 CREATE TABLE T_ER_PUBREIMEXPDET (
FID BIGINT DEFAULT 0 NOT NULL,
FDETAILID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FEXPENSEITEMID BIGINT DEFAULT 0 NOT NULL,
FHAPPENDATE DATETIME,
FEXCHANGERATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FORIAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FCURRREIMBURSEAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FREIMBURSEAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL,
FISSPECIALINVOICE CHAR(1) DEFAULT '1' NOT NULL,
FENTRYCURRENCY BIGINT DEFAULT 0 NOT NULL,
FEXPEAPPROVEAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FEXPEAPPROVECURRAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FEXPEBALANCEAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXCLASSCODEID BIGINT DEFAULT 0 NOT NULL,
FINVOICENO NVARCHAR(129) DEFAULT ' ' NOT NULL,
FINVOICELINK NVARCHAR(129) DEFAULT ' ' NOT NULL,
FOFFSET CHAR(1) DEFAULT '1' NOT NULL,
FENTRYCOSTCOMPANYID BIGINT DEFAULT 0 NOT NULL,
FENTRYCOSTDEPTID BIGINT DEFAULT 0 NOT NULL,
FSERIALNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FAIRPORTCONSTRUCTIONFEE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FGOODSNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FDEDUCTIBLETAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPROJECTID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_ER_PUBREIMINVOICEINFO')
 CREATE TABLE T_ER_PUBREIMINVOICEINFO (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FINVOICETYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FINVOICENO NVARCHAR(129) DEFAULT ' ' NOT NULL,
FINVOICECODE NVARCHAR(129) DEFAULT ' ' NOT NULL,
FTOTALAMOUNT DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FTAXRATE DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FTAXAMOUNT DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FSERIALNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(255),
FBUYERNAME NVARCHAR(80) DEFAULT ' ' NOT NULL,
FMAKEOUTCOMPNAME NVARCHAR(80) DEFAULT ' ' NOT NULL,
FCOUNT INT DEFAULT 0 NOT NULL,
FFROMINVOICECLOUD CHAR(1) DEFAULT '0' NOT NULL,
FBUYERORGID BIGINT DEFAULT 0 NOT NULL,
FOFFSET CHAR(1) DEFAULT '0' NOT NULL,
FOFFSETAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FINOUTAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FVALIDATEMESSAGE NVARCHAR(255) DEFAULT ' ' NOT NULL,
FINVOICEDATE DATETIME,
FPASSENGERNAME NVARCHAR(255),
FAIRPORTCONSTRUCTIONFEE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FALLTAXRATE VARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_ER_PUBREIMINVOICEITEM')
 CREATE TABLE T_ER_PUBREIMINVOICEITEM (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FITEMENTRYID BIGINT DEFAULT 0 NOT NULL,
FINVOICEHEADENTRYID BIGINT DEFAULT 0 NOT NULL,
FUNITPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FEXCLUDEAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSPECMODEL NVARCHAR(50) DEFAULT ' ' NOT NULL,
FUNIT NVARCHAR(50) DEFAULT ' ' NOT NULL,
FTAXAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FGOODSCODE VARCHAR(255) DEFAULT ' ' NOT NULL,
FNUM DECIMAL(23,10) DEFAULT 0 NOT NULL,
FGOODSNAME VARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_ER_PUBREIMWRIOFFAPPLY')
 CREATE TABLE T_ER_PUBREIMWRIOFFAPPLY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FAPPLYBILLNO VARCHAR(100) DEFAULT '0' NOT NULL,
FAPPLYPERSON VARCHAR(200) DEFAULT ' ' NOT NULL,
FAPPLYBILLDATE DATETIME,
FAPPLYDESCRIPTION NVARCHAR(600) DEFAULT ' ' NOT NULL,
FAPPLYCURRENCY BIGINT DEFAULT 0 NOT NULL,
FAPPLYEXCHANGERATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FORGIEXPEBALANCEAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FEXPEBALANCEAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FREIMBURSEDAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FREIMBURSEDCURRAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_ER_PUBREIMWRIOFFDET')
 CREATE TABLE T_ER_PUBREIMWRIOFFDET (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FLOANEXCHANGERATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FCURRLOANAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FCURRACCLOANAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FACCLOANAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOANBILL BIGINT DEFAULT 0 NOT NULL,
FLOANAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOANCURRENCY BIGINT DEFAULT 0 NOT NULL,
FLOANPERSON VARCHAR(200) DEFAULT ' ' NOT NULL,
FLOANBILLNOV1 VARCHAR(100) DEFAULT '0' NOT NULL,
FLOANAPPLYDATEV1 DATETIME,
FLOANDESCRIPTIONV1 NVARCHAR(600) DEFAULT ' ' NOT NULL,
FSOURCESIGN CHAR(1) DEFAULT '0' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_ER_PUBREIMBILL')
 CREATE TABLE T_ER_PUBREIMBILL (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO VARCHAR(60) DEFAULT ' ' NOT NULL,
FBILLSTATUS VARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FCOMPANYID BIGINT DEFAULT 0 NOT NULL,
FBIZDATE DATETIME,
FISCURRENCY CHAR(1) DEFAULT '0' NOT NULL,
FDESCRIPTION NVARCHAR(600) DEFAULT ' ' NOT NULL,
FCOSTCOMPANYID BIGINT DEFAULT 0 NOT NULL,
FCOSTDEPTID BIGINT DEFAULT 0 NOT NULL,
FAPPLIERID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FCURRENCYID BIGINT DEFAULT 0 NOT NULL,
FTEL VARCHAR(100) DEFAULT ' ' NOT NULL,
FREIMBURSEAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FAPPROVEAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FREIMBURSECURRENCY BIGINT DEFAULT 0 NOT NULL,
FPAYAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPAYCURRENCY BIGINT DEFAULT 0 NOT NULL,
FNEXTAUDITOR NVARCHAR(100) DEFAULT ' ' NOT NULL,
FAUDITOPINION VARCHAR(100) DEFAULT ' ' NOT NULL,
FIMAGENUMBER VARCHAR(255) DEFAULT ' ' NOT NULL,
FFORMID VARCHAR(30) DEFAULT ' ' NOT NULL,
FTOTALACCLOANAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSOURCEBILLTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FHASVOUCHER CHAR(1) DEFAULT '0' NOT NULL,
FNOTPAYAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPAYEDAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL
);
/**End 对公报销单相关物理表创建 **/
