/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\IM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IM_INVADVICE') 
 CREATE TABLE T_IM_INVADVICE (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FSUPPLYORGID BIGINT DEFAULT 0 NOT NULL,
FADVICETYPE CHAR(1) DEFAULT ' ' NOT NULL,
FCALCULATENUM NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBALANCEINVSCHEMEID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITTIME DATETIME,
FREPEALUSERID BIGINT DEFAULT 0 NOT NULL,
FREPEALTIME DATETIME,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FDEMANDKIND CHAR(1) DEFAULT ' ' NOT NULL,
FBIZTYPEID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IM_INVADVICEENTRY') 
 CREATE TABLE T_IM_INVADVICEENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FAUXPTYID BIGINT DEFAULT 0 NOT NULL,
FBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBASEUNITID BIGINT DEFAULT 0 NOT NULL,
FREMAININBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FJOININBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMVERSION BIGINT DEFAULT 0 NOT NULL,
FPLANSTARTDATE DATETIME,
FPLANFINISHDATE DATETIME,
FDEMANDBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FDEMANDORGID BIGINT DEFAULT 0 NOT NULL,
FAPPLYBILLTYPE BIGINT DEFAULT 0 NOT NULL,
FDEMANDBILLID BIGINT DEFAULT 0 NOT NULL,
FDEMANDBILLENTRYID BIGINT DEFAULT 0 NOT NULL,
FDEMANDSEQ INT DEFAULT 0 NOT NULL,
FINVORGID BIGINT DEFAULT 0 NOT NULL,
FOWNERTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FOWNERID BIGINT DEFAULT 0 NOT NULL,
FWAREHOUSEID BIGINT DEFAULT 0 NOT NULL,
FLOCATIONID BIGINT DEFAULT 0 NOT NULL,
FISCLOSED CHAR(1) DEFAULT ' ' NOT NULL
);



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