/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\SM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SM_SIMULATEDETAILENTRY') 
 CREATE TABLE T_SM_SIMULATEDETAILENTRY (
FDETAILID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FSUBMATERIALID BIGINT DEFAULT 0 NOT NULL,
FSUBAUXPTYID BIGINT DEFAULT 0 NOT NULL,
FSUBUNITID BIGINT DEFAULT 0 NOT NULL,
FSUBQTYNUMERATOR DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUBQTYDENOMINATOR DECIMAL(23,10) DEFAULT 1 NOT NULL,
FSUBQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUBBASEUNITID BIGINT DEFAULT 0 NOT NULL,
FSUBBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUBMATERIALPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUBMATERIALAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUBPROCESSPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUBPROCESSAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUBWORKHOURS DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUBWORKPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUBLABORCOST DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUBMANUFACTUREPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUBMANUFACTURECOST DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUBPIECEWORKPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUBPIECEWORKAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUBREMARK NVARCHAR(255)
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SM_SIMULATEQUOTE') 
 CREATE TABLE T_SM_SIMULATEQUOTE (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FBIZTYPEID BIGINT DEFAULT 0 NOT NULL,
FBIZDATE DATETIME,
FBILLSTATUS VARCHAR(5) DEFAULT ' ' NOT NULL,
FCOMMENT NVARCHAR(512),
FORGID BIGINT DEFAULT 0 NOT NULL,
FCUSTOMERID BIGINT DEFAULT 0 NOT NULL,
FLINKMANID BIGINT DEFAULT 0 NOT NULL,
FADDRESS NVARCHAR(512),
FCURRENCYID BIGINT DEFAULT 0 NOT NULL,
FSETTLECURRENCYID BIGINT DEFAULT 0 NOT NULL,
FEXRATETABLEID BIGINT DEFAULT 0 NOT NULL,
FEXRATEDATE DATETIME,
FEXCHANGETYPE VARCHAR(5) DEFAULT ' ' NOT NULL,
FEXCHANGERATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FLASTUPDATEUSERID BIGINT DEFAULT 0 NOT NULL,
FLASTUPDATETIME DATETIME,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FCLOSESTATUS VARCHAR(5) DEFAULT ' ' NOT NULL,
FCLOSERID BIGINT DEFAULT 0 NOT NULL,
FCLOSEDATE DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SM_SIMULATEQUOTEENTRY') 
 CREATE TABLE T_SM_SIMULATEQUOTEENTRY (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FPARENTENTRYID BIGINT DEFAULT 0 NOT NULL,
FLINETYPEID BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FAUXPTYID BIGINT DEFAULT 0 NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FBASEUNITID BIGINT DEFAULT 0 NOT NULL,
FQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPRICEANDTAX DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXRATEID BIGINT DEFAULT 0 NOT NULL,
FTAXRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMATERIALCOST DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPROCESSCOST DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMANUFACTURECOST DECIMAL(23,10) DEFAULT 0 NOT NULL,
FLABORCOST DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPIECEWORKAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FQUOTECOST DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCOSTUPRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FREMARK NVARCHAR(255)
);



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