/**Begin D:\PDM_UPGRADE\PDM1\PDM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IM_MDC_OMINBILLENTRY_R') 
 CREATE TABLE T_IM_MDC_OMINBILLENTRY_R (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FMVERSION BIGINT DEFAULT 0 NOT NULL,
FLOGISTICSBILL CHAR(1) DEFAULT '0' NOT NULL,
FSRCSYSBILLENTRYID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCSYSTEM NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCSYSBILLID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLENTITY NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLENTRYID BIGINT DEFAULT 0 NOT NULL,
FSRCBILLID BIGINT DEFAULT 0 NOT NULL,
FSRCBILLNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLENTRYSEQ BIGINT DEFAULT 0 NOT NULL,
FMAINBILLENTITY NVARCHAR(50) DEFAULT ' ' NOT NULL,
FMAINBILLNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FMAINBILLID BIGINT DEFAULT 0 NOT NULL,
FMAINBILLENTRYID BIGINT DEFAULT 0 NOT NULL,
FMAINBILLENTRYSEQ BIGINT DEFAULT 0 NOT NULL,
FRETURNQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FRETURNBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FREMAINRETURNQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FREMAINRETURNBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FJOINPRICEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FJOINPRICEBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FREMAINJOINPRICEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FREMAINJOINPRICEBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FVERIFYQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FVERIFYBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FUNVERIFYQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FUNVERIFYBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FVMISETTLEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FVMISETTLEBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FVMIREMAINSETTLEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FVMIREMAINSETTLEBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IM_MDC_OMINBILLENTRY_L') 
 CREATE TABLE T_IM_MDC_OMINBILLENTRY_L (
FPKID NVARCHAR(18) DEFAULT ' ' NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FPROVIDERADDRESS NVARCHAR(300) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IM_MDC_OMINBILLENTRY_F') 
 CREATE TABLE T_IM_MDC_OMINBILLENTRY_F (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FENTRYSETTLEORGID BIGINT DEFAULT 0 NOT NULL,
FTAXRATEID BIGINT DEFAULT 0 NOT NULL,
FTAXRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPRICEANDTAX DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDISCOUNTTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FDISCOUNTRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FACTUALPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FACTUALTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDISCOUNTAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCURAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCURTAXAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FAMOUNTANDTAX DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCURAMOUNTANDTAX DECIMAL(23,10) DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IM_MDC_OMINBILLENTRY') 
 CREATE TABLE T_IM_MDC_OMINBILLENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FMATERIALMASTERID BIGINT DEFAULT 0 NOT NULL,
FAUXPTYID BIGINT DEFAULT 0 NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBASEUNITID BIGINT DEFAULT 0 NOT NULL,
FBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FUNIT2NDID BIGINT DEFAULT 0 NOT NULL,
FQTYUNIT2ND DECIMAL(23,10) DEFAULT 0 NOT NULL,
FLOTID BIGINT DEFAULT 0 NOT NULL,
FLOTNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSERIALNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSUPLOT NVARCHAR(50) DEFAULT ' ' NOT NULL,
FPRODUCEDATE DATETIME,
FEXPIRYDATE DATETIME,
FRECEIVEDATE DATETIME,
FWAREHOUSEID BIGINT DEFAULT 0 NOT NULL,
FLOCATIONID BIGINT DEFAULT 0 NOT NULL,
FINVTYPEID BIGINT DEFAULT 0 NOT NULL,
FINVSTATUSID BIGINT DEFAULT 0 NOT NULL,
FOWNERTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FOWNERID BIGINT DEFAULT 0 NOT NULL,
FKEEPERTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FKEEPERID BIGINT DEFAULT 0 NOT NULL,
FENTRYREQORGID BIGINT DEFAULT 0 NOT NULL,
FOUTINVTYPEID BIGINT DEFAULT 0 NOT NULL,
FOUTINVSTATUSID BIGINT DEFAULT 0 NOT NULL,
FOUTOWNERTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FOUTOWNERID BIGINT DEFAULT 0 NOT NULL,
FOUTKEEPERTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FOUTKEEPERID BIGINT DEFAULT 0 NOT NULL,
FPROJECTID BIGINT DEFAULT 0 NOT NULL,
FISPRESENT CHAR(1) DEFAULT '0' NOT NULL,
FPROVIDERSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FINVOICESUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FRECEIVESUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FPROVIDERADDRESS NVARCHAR(300) DEFAULT ' ' NOT NULL,
FPROVIDERLINKMANID BIGINT DEFAULT 0 NOT NULL,
FENTRYCOMMENT NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IM_MDC_OMINBILL_L') 
 CREATE TABLE T_IM_MDC_OMINBILL_L (
FPKID NVARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FCOMMENT NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IM_MDC_OMINBILL') 
 CREATE TABLE T_IM_MDC_OMINBILL (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(30) DEFAULT ' ' NOT NULL,
FBILLSTATUS NVARCHAR(30) 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,
FCURRENCYID BIGINT DEFAULT 0 NOT NULL,
FSETTLECURRENCYID BIGINT DEFAULT 0 NOT NULL,
FEXRATETABLE BIGINT DEFAULT 0 NOT NULL,
FEXRATEDATE DATETIME,
FEXCHANGERATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPAYMODE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FSETTLETYPEID BIGINT DEFAULT 0 NOT NULL,
FPAYCONDITIONID BIGINT DEFAULT 0 NOT NULL,
FISTAX CHAR(1) DEFAULT '1' NOT NULL,
FBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FBIZTYPEID BIGINT DEFAULT 0 NOT NULL,
FINVSCHEMEID BIGINT DEFAULT 0 NOT NULL,
FBIZTIME DATETIME,
FBIZORGID BIGINT DEFAULT 0 NOT NULL,
FBIZDEPTID BIGINT DEFAULT 0 NOT NULL,
FBIZOPERATORID BIGINT DEFAULT 0 NOT NULL,
FBIZOPERATORGROUPID BIGINT DEFAULT 0 NOT NULL,
FDEPTID BIGINT DEFAULT 0 NOT NULL,
FOPERATORID BIGINT DEFAULT 0 NOT NULL,
FOPERATORGROUPID BIGINT DEFAULT 0 NOT NULL,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FBOOKDATE DATETIME,
FISVIRTUALBILL CHAR(1) DEFAULT '0' NOT NULL,
FASYNCSTATUS NVARCHAR(30) DEFAULT ' ' NOT NULL,
FBILLCRETYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FTRANSACTEPATHID BIGINT DEFAULT 0 NOT NULL,
FISINITBILL CHAR(1) DEFAULT '0' NOT NULL,
FCOMMENT NVARCHAR(255) DEFAULT ' ' NOT NULL,
FHASAPBUSBILL CHAR(1) DEFAULT '0' NOT NULL
);



/**End D:\PDM_UPGRADE\PDM1\PDM_table.sql **/
