/**Begin C:\PDM_UPGRADE\PDM1\PUR_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_PLAN_L') 
 CREATE TABLE T_PUR_PLAN_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_PAYAPPLYENTRY_A') 
 CREATE TABLE T_PUR_PAYAPPLYENTRY_A (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FLOCPAYAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCAPPLYAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCAPPROVEAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FMATERIALDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FGOODSID BIGINT DEFAULT 0 NOT NULL,
FGOODSDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FPOBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPOENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_PAYENTRY_A') 
 CREATE TABLE T_PUR_PAYENTRY_A (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FLOCAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCDCTAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCFEEAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCPAYAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FMATERIALDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FGOODSID BIGINT DEFAULT 0 NOT NULL,
FGOODSDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FPOBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPOENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_CONTRACTENTRY_A') 
 CREATE TABLE T_PUR_CONTRACTENTRY_A (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FGOODSID BIGINT DEFAULT 0 NOT NULL,
FGOODSDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FBASICUNITID BIGINT DEFAULT 0 NOT NULL,
FBASICQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSTUNITID BIGINT DEFAULT 0 NOT NULL,
FASSTQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FACTPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FACTTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPOBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPOENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_OUTRETURNENTRY_A') 
 CREATE TABLE T_PUR_OUTRETURNENTRY_A (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FGOODSID BIGINT DEFAULT 0 NOT NULL,
FGOODSDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FBASICUNITID BIGINT DEFAULT 0 NOT NULL,
FBASICQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSTUNITID BIGINT DEFAULT 0 NOT NULL,
FASSTQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FACTPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FACTTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPOBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPOENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_OUTSTOCKENTRY_A') 
 CREATE TABLE T_PUR_OUTSTOCKENTRY_A (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FGOODSID BIGINT DEFAULT 0 NOT NULL,
FGOODSDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FBASICUNITID BIGINT DEFAULT 0 NOT NULL,
FBASICQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSTUNITID BIGINT DEFAULT 0 NOT NULL,
FASSTQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FACTPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FACTTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPOBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPOENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_OUTTRANENTRY_A') 
 CREATE TABLE T_PUR_OUTTRANENTRY_A (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FGOODSID BIGINT DEFAULT 0 NOT NULL,
FGOODSDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FBASICUNITID BIGINT DEFAULT 0 NOT NULL,
FBASICQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSTUNITID BIGINT DEFAULT 0 NOT NULL,
FASSTQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FACTPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FACTTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPOBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPOENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_PLANENTRY_A') 
 CREATE TABLE T_PUR_PLANENTRY_A (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FGOODSID BIGINT DEFAULT 0 NOT NULL,
FGOODSDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FBASICUNITID BIGINT DEFAULT 0 NOT NULL,
FBASICQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSTUNITID BIGINT DEFAULT 0 NOT NULL,
FASSTQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPOBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPOENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_REPLENISHENTRY_A') 
 CREATE TABLE T_PUR_REPLENISHENTRY_A (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FGOODSID BIGINT DEFAULT 0 NOT NULL,
FGOODSDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FBASICUNITID BIGINT DEFAULT 0 NOT NULL,
FBASICQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSTUNITID BIGINT DEFAULT 0 NOT NULL,
FASSTQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPOBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPOENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_CONSUMPT') 
 CREATE TABLE T_PUR_CONSUMPT (
FID BIGINT DEFAULT 0 NOT NULL,
FINVORGID BIGINT DEFAULT 0 NOT NULL,
FUSEORGID BIGINT DEFAULT 0 NOT NULL,
FOWNERID BIGINT DEFAULT 0 NOT NULL,
FBILLDATE DATETIME,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FMATERIALDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FASSTPROID VARCHAR(50) DEFAULT ' ' NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FWAREHOUSEID BIGINT DEFAULT 0 NOT NULL,
FLOTID BIGINT DEFAULT 0 NOT NULL,
FSUPLOT NVARCHAR(80) DEFAULT ' ' NOT NULL,
FQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSETTLEQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FINVQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPAYQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FENTRYSEQ BIGINT DEFAULT 0 NOT NULL,
FGOODSID BIGINT DEFAULT 0 NOT NULL,
FGOODSDESC NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_SETTLE_A') 
 CREATE TABLE T_PUR_SETTLE_A (
FID 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,
FAUDITDATE DATETIME,
FCFMID BIGINT DEFAULT 0 NOT NULL,
FCFMDATE DATETIME,
FORIGIN CHAR(1) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_INVENTORY') 
 CREATE TABLE T_PUR_INVENTORY (
FID BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FMATERIALDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FASSTPROID VARCHAR(50) DEFAULT ' ' NOT NULL,
FLOTID BIGINT DEFAULT 0 NOT NULL,
FSUPLOT NVARCHAR(80) DEFAULT ' ' NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FASSTUNITID BIGINT DEFAULT 0 NOT NULL,
FASSTQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FOWNERID BIGINT DEFAULT 0 NOT NULL,
FINVORGID BIGINT DEFAULT 0 NOT NULL,
FWAREHOUSEID BIGINT DEFAULT 0 NOT NULL,
FPRODDATE DATETIME,
FDUEDATE DATETIME,
FSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FGOODSID BIGINT DEFAULT 0 NOT NULL,
FGOODSDESC NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_CONTRACTPAY') 
 CREATE TABLE T_PUR_CONTRACTPAY (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FPAYDATE DATETIME,
FPAYRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPAYAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPAYNOTE NVARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_CONTRACTITEM') 
 CREATE TABLE T_PUR_CONTRACTITEM (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FITEMID BIGINT DEFAULT 0 NOT NULL,
FTYPEID BIGINT DEFAULT 0 NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FCONTENT NVARCHAR(500) DEFAULT ' ' NOT NULL,
FNOTE NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_CONTRACTCOST') 
 CREATE TABLE T_PUR_CONTRACTCOST (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FCOSTID BIGINT DEFAULT 0 NOT NULL,
FAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FNOTE NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_CONCHANGEPAY') 
 CREATE TABLE T_PUR_CONCHANGEPAY (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FCHGTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FPAYDATE DATETIME,
FPAYDATEOLD DATETIME,
FPAYRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPAYRATEOLD DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPAYAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPAYAMOUNTOLD DECIMAL(19,6) DEFAULT 0 NOT NULL,
FNOTE NVARCHAR(255) DEFAULT ' ' NOT NULL,
FENTRYSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FPCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_CONCHANGECOST') 
 CREATE TABLE T_PUR_CONCHANGECOST (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FCHGTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FCOSTOLDID BIGINT DEFAULT 0 NOT NULL,
FCOSTID BIGINT DEFAULT 0 NOT NULL,
FAMOUNTOLD DECIMAL(19,6) DEFAULT 0 NOT NULL,
FAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXRATEOLD DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FNOTE NVARCHAR(255) DEFAULT ' ' NOT NULL,
FENTRYSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FPCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_RECEIVE_LOG') 
 CREATE TABLE T_PUR_RECEIVE_LOG (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FLOGBILLNO VARCHAR(80) DEFAULT ' ' NOT NULL,
FLOGDATE DATETIME,
FDELIDATE DATETIME,
FNOTE NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_CONCHANGEITEM') 
 CREATE TABLE T_PUR_CONCHANGEITEM (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FCHGTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FITEMOLDID BIGINT DEFAULT 0 NOT NULL,
FTYPEID BIGINT DEFAULT 0 NOT NULL,
FTYPEOLDID BIGINT DEFAULT 0 NOT NULL,
FITEMID BIGINT DEFAULT 0 NOT NULL,
FNAMEOLD NVARCHAR(255) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FCONTENTOLD NVARCHAR(500) DEFAULT ' ' NOT NULL,
FCONTENT NVARCHAR(500) DEFAULT ' ' NOT NULL,
FNOTEOLD NVARCHAR(255) DEFAULT ' ' NOT NULL,
FNOTE NVARCHAR(255) DEFAULT ' ' NOT NULL,
FENTRYSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FPCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_SETTLENTRY') 
 CREATE TABLE T_PUR_SETTLENTRY (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FMATERIALDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FASSTPROID VARCHAR(50) DEFAULT ' ' NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FUSEQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FREMAINQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDCTRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FDCTAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FISPRESENT CHAR(1) DEFAULT ' ' NOT NULL,
FLOTID BIGINT DEFAULT 0 NOT NULL,
FSUPLOT NVARCHAR(80) DEFAULT ' ' NOT NULL,
FWAREHOUSEID BIGINT DEFAULT 0 NOT NULL,
FNOTE NVARCHAR(255) DEFAULT ' ' NOT NULL,
FENTRYSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FPOBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPCBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPROJECTID BIGINT DEFAULT 0 NOT NULL,
FTRACEID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_PLANENTRY') 
 CREATE TABLE T_PUR_PLANENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FMATERIALDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FASSTPROID VARCHAR(50) DEFAULT ' ' NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FREQDATE DATETIME,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FREQORGID BIGINT DEFAULT 0 NOT NULL,
FPURORGID BIGINT DEFAULT 0 NOT NULL,
FNOTE NVARCHAR(255) DEFAULT ' ' NOT NULL,
FENTRYSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FPOBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPCBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPROJECTID BIGINT DEFAULT 0 NOT NULL,
FTRACEID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_APPLYENTRY') 
 CREATE TABLE T_PUR_APPLYENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FMATERIALDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FASSTPROID VARCHAR(50) DEFAULT ' ' NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FREQQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FDELIDATE DATETIME,
FDELIADDR NVARCHAR(255) DEFAULT ' ' NOT NULL,
FPURPOSE NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FPURLEADDAY INT DEFAULT 0 NOT NULL,
FPURDATE DATETIME,
FQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDCTRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FDCTAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FREQORGID BIGINT DEFAULT 0 NOT NULL,
FPURORGID BIGINT DEFAULT 0 NOT NULL,
FRCVORGID BIGINT DEFAULT 0 NOT NULL,
FWAREHOUSEID BIGINT DEFAULT 0 NOT NULL,
FSETTLEORGID BIGINT DEFAULT 0 NOT NULL,
FPAYORGID BIGINT DEFAULT 0 NOT NULL,
FPURPERSONID BIGINT DEFAULT 0 NOT NULL,
FNOTE NVARCHAR(255) DEFAULT ' ' NOT NULL,
FENTRYSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FINQUIRYSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FBIDSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FPOBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPCBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPROJECTID BIGINT DEFAULT 0 NOT NULL,
FTRACEID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_RECEIVENTRY_A') 
 CREATE TABLE T_PUR_RECEIVENTRY_A (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FGOODSID BIGINT DEFAULT 0 NOT NULL,
FGOODSDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FBASICUNITID BIGINT DEFAULT 0 NOT NULL,
FBASICQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSTUNITID BIGINT DEFAULT 0 NOT NULL,
FASSTQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FACTPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FACTTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPOBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPOENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSUMOUTSTOCKQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMRECEIPTQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FORDERQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FREMAINQTY DECIMAL(19,6) DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_SALRETURNENTRY_A') 
 CREATE TABLE T_PUR_SALRETURNENTRY_A (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FGOODSID BIGINT DEFAULT 0 NOT NULL,
FGOODSDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FBASICUNITID BIGINT DEFAULT 0 NOT NULL,
FBASICQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSTUNITID BIGINT DEFAULT 0 NOT NULL,
FASSTQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FACTPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FACTTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPOBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPOENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSUMCHECKQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMCHECKAMT DECIMAL(19,6) DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_CHECKENTRY_A') 
 CREATE TABLE T_PUR_CHECKENTRY_A (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FGOODSID BIGINT DEFAULT 0 NOT NULL,
FGOODSDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FBASICUNITID BIGINT DEFAULT 0 NOT NULL,
FBASICQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSTUNITID BIGINT DEFAULT 0 NOT NULL,
FASSTQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FACTPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FACTTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPOBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPOENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSUMINVQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMINVAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FINVOICEID VARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_INVOICENTRY_A') 
 CREATE TABLE T_PUR_INVOICENTRY_A (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FGOODSID BIGINT DEFAULT 0 NOT NULL,
FGOODSDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FBASICUNITID BIGINT DEFAULT 0 NOT NULL,
FBASICQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSTUNITID BIGINT DEFAULT 0 NOT NULL,
FASSTQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FACTPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPOBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPOENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FACTTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUMPAYAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FINVOICEID VARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_CONCHANGENTRY_A') 
 CREATE TABLE T_PUR_CONCHANGENTRY_A (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FQTYOLD DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPRICEOLD DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXPRICEOLD DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDCTRATEOLD DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXRATEOLD DECIMAL(19,6) DEFAULT 0 NOT NULL,
FDELIDATEOLD DATETIME,
FDELIADDROLD NVARCHAR(255) DEFAULT ' ' NOT NULL,
FGOODSID BIGINT DEFAULT 0 NOT NULL,
FGOODSDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FPCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_SETTLENTRY_A') 
 CREATE TABLE T_PUR_SETTLENTRY_A (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FGOODSID BIGINT DEFAULT 0 NOT NULL,
FGOODSDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FBASICUNITID BIGINT DEFAULT 0 NOT NULL,
FBASICQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSTUNITID BIGINT DEFAULT 0 NOT NULL,
FASSTQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FACTPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FACTTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPOBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPOENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_CONTRACTTEMP_A') 
 CREATE TABLE T_PUR_CONTRACTTEMP_A (
FID 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,
FAUDITDATE DATETIME,
FCFMID BIGINT DEFAULT 0 NOT NULL,
FCFMDATE DATETIME,
FORIGIN CHAR(1) DEFAULT ' ' NOT NULL,
FBILLVERSION NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_RECEIVENTRY') 
 CREATE TABLE T_PUR_RECEIVENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FMATERIALDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FASSTPROID VARCHAR(50) DEFAULT ' ' NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDCTRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FDCTAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FISPRESENT CHAR(1) DEFAULT ' ' NOT NULL,
FDELIDATE DATETIME,
FDELIADDR NVARCHAR(255) DEFAULT ' ' NOT NULL,
FREQORGID BIGINT DEFAULT 0 NOT NULL,
FPURORGID BIGINT DEFAULT 0 NOT NULL,
FRCVORGID BIGINT DEFAULT 0 NOT NULL,
FSETTLEORGID BIGINT DEFAULT 0 NOT NULL,
FPAYORGID BIGINT DEFAULT 0 NOT NULL,
FWAREHOUSEID BIGINT DEFAULT 0 NOT NULL,
FNOTE NVARCHAR(255) DEFAULT ' ' NOT NULL,
FENTRYSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FPOBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPCBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPROJECTID BIGINT DEFAULT 0 NOT NULL,
FTRACEID BIGINT DEFAULT 0 NOT NULL,
FLOTID BIGINT DEFAULT 0 NOT NULL,
FSUPLOT NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPRODDATE DATETIME,
FDUEDATE DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_CONCHANGENTRY') 
 CREATE TABLE T_PUR_CONCHANGENTRY (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FCHGTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FMATERIALDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FASSTPROID VARCHAR(50) DEFAULT ' ' NOT NULL,
FMATCLASSID BIGINT DEFAULT 0 NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDCTRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FDELIDATE DATETIME,
FDELIADDR NVARCHAR(255) DEFAULT ' ' NOT NULL,
FNOTE NVARCHAR(255) DEFAULT ' ' NOT NULL,
FENTRYSTATUS CHAR(1) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_OUTSTOCKENTRY') 
 CREATE TABLE T_PUR_OUTSTOCKENTRY (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FMATERIALDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FASSTPROID VARCHAR(50) DEFAULT ' ' NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FREQQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FWAREHOUSEID BIGINT DEFAULT 0 NOT NULL,
FLOTID BIGINT DEFAULT 0 NOT NULL,
FPLANBILLNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FNOTE NVARCHAR(255) DEFAULT ' ' NOT NULL,
FENTRYSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDCTRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FDCTAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPOBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPCBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPROJECTID BIGINT DEFAULT 0 NOT NULL,
FTRACEID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_OUTTRANENTRY') 
 CREATE TABLE T_PUR_OUTTRANENTRY (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FMATERIALDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FASSTPROID VARCHAR(50) DEFAULT ' ' NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FOUTWAREHOUSEID BIGINT DEFAULT 0 NOT NULL,
FINWAREHOUSEID BIGINT DEFAULT 0 NOT NULL,
FLOTID BIGINT DEFAULT 0 NOT NULL,
FNOTE NVARCHAR(255) DEFAULT ' ' NOT NULL,
FENTRYSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDCTRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FDCTAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPOBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPCBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPROJECTID BIGINT DEFAULT 0 NOT NULL,
FTRACEID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_OUTRETURNENTRY') 
 CREATE TABLE T_PUR_OUTRETURNENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FMATERIALDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FASSTPROID VARCHAR(50) DEFAULT ' ' NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FREQQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FWAREHOUSEID BIGINT DEFAULT 0 NOT NULL,
FLOTID BIGINT DEFAULT 0 NOT NULL,
FRETREASON NVARCHAR(255) DEFAULT ' ' NOT NULL,
FNOTE NVARCHAR(255) DEFAULT ' ' NOT NULL,
FENTRYSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDCTRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FDCTAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPOBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPCBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPROJECTID BIGINT DEFAULT 0 NOT NULL,
FTRACEID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_REPLENISHENTRY') 
 CREATE TABLE T_PUR_REPLENISHENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FMATERIALDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FASSTPROID VARCHAR(50) DEFAULT ' ' NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FINVQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FADVQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FREQQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FBATQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FNEEDQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSAFEQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FALLOTQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FONWAYQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FWAREHOUSEID BIGINT DEFAULT 0 NOT NULL,
FLOTID BIGINT DEFAULT 0 NOT NULL,
FREQDATE DATETIME,
FNOTE NVARCHAR(255) DEFAULT ' ' NOT NULL,
FENTRYSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FPOBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPCBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPROJECTID BIGINT DEFAULT 0 NOT NULL,
FTRACEID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_CONTRACTENTRY') 
 CREATE TABLE T_PUR_CONTRACTENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FMATERIALDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FASSTPROID VARCHAR(50) DEFAULT ' ' NOT NULL,
FMATCLASSID BIGINT DEFAULT 0 NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDCTRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FDCTAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FDELIDATE DATETIME,
FDELIADDR NVARCHAR(255) DEFAULT ' ' NOT NULL,
FREQORGID BIGINT DEFAULT 0 NOT NULL,
FRCVORGID BIGINT DEFAULT 0 NOT NULL,
FSETTLEORGID BIGINT DEFAULT 0 NOT NULL,
FNOTE NVARCHAR(255) DEFAULT ' ' NOT NULL,
FENTRYSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FPOBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPCBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPROJECTID BIGINT DEFAULT 0 NOT NULL,
FTRACEID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_COMPANYREGISTER') 
 CREATE TABLE T_PUR_COMPANYREGISTER (
FID BIGINT DEFAULT 0 NOT NULL,
FCOMPANYID BIGINT DEFAULT 0 NOT NULL,
FMASTER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FIDENTITY VARCHAR(30) DEFAULT ' ' NOT NULL,
FMOBILE VARCHAR(30) DEFAULT ' ' NOT NULL,
FICCODE VARCHAR(50) DEFAULT ' ' NOT NULL,
FORGCODE VARCHAR(50) DEFAULT ' ' NOT NULL,
FSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FTAXCODE VARCHAR(50) DEFAULT ' ' NOT NULL,
FEUSER VARCHAR(80) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_CONTRACTTEMPENTRY') 
 CREATE TABLE T_PUR_CONTRACTTEMPENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FTYPE BIGINT DEFAULT 0 NOT NULL,
FVALUE NVARCHAR(255) DEFAULT ' ' NOT NULL,
FLENGTH INT DEFAULT 0 NOT NULL,
FISREQUEST CHAR(1) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_CRENTRY') 
 CREATE TABLE T_PUR_CRENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FPUSERID BIGINT DEFAULT 0 NOT NULL,
FPHONE VARCHAR(30) DEFAULT ' ' NOT NULL
);


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


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


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


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


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


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


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


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_SALOUTSTOCKENTRY_A') 
 CREATE TABLE T_PUR_SALOUTSTOCKENTRY_A (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FGOODSID BIGINT DEFAULT 0 NOT NULL,
FGOODSDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FBASICUNITID BIGINT DEFAULT 0 NOT NULL,
FBASICQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSTUNITID BIGINT DEFAULT 0 NOT NULL,
FASSTQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FACTPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FACTTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPOBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPOENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSUMRECEIPTQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMINSTOCKQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMCHECKQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMCHECKAMT DECIMAL(19,6) DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_ECADMIT_L') 
 CREATE TABLE T_PUR_ECADMIT_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL,
FINVOICE NVARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_APPLYENTRY_A') 
 CREATE TABLE T_PUR_APPLYENTRY_A (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FGOODSID BIGINT DEFAULT 0 NOT NULL,
FGOODSDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FBASICUNITID BIGINT DEFAULT 0 NOT NULL,
FBASICQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSTUNITID BIGINT DEFAULT 0 NOT NULL,
FASSTQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FACTPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FACTTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPOBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPOENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSUMINQUIRYQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMBIDQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMORDERQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPURTYPEID BIGINT DEFAULT 0 NOT NULL,
FCOSTITEMID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_CONTRACTTEMP') 
 CREATE TABLE T_PUR_CONTRACTTEMP (
FID BIGINT DEFAULT 0 NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FNOTE NVARCHAR(255) DEFAULT ' ' NOT NULL,
FBILLDATE DATETIME,
FPERSONID BIGINT DEFAULT 0 NOT NULL,
FBIZTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FCFMSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCONTEXT NCLOB,
FCONTEXT_TAG NCLOB
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_THIRDCHECKENTRY') 
 CREATE TABLE T_PUR_THIRDCHECKENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FRCVNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FRCVDATE DATETIME,
FRCVQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FRCVAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FRCVENTRYID BIGINT DEFAULT 0 NOT NULL,
FTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FGOODSID BIGINT DEFAULT 0 NOT NULL,
FLINETYPEID BIGINT DEFAULT 0 NOT NULL,
FPURTYPEID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_INSTOCK_A') 
 CREATE TABLE T_PUR_INSTOCK_A (
FID 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,
FAUDITDATE DATETIME,
FCFMID BIGINT DEFAULT 0 NOT NULL,
FCFMDATE DATETIME,
FORIGIN CHAR(1) DEFAULT ' ' NOT NULL,
FISINITIAL CHAR(1) DEFAULT ' ' NOT NULL,
FISCENTERSETTLE CHAR(1) DEFAULT ' ' NOT NULL,
FISVIRTUAL CHAR(1) DEFAULT ' ' NOT NULL,
FISCHECK CHAR(1) DEFAULT ' ' NOT NULL,
FCHKBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_CHECKENTRY2_A') 
 CREATE TABLE T_PUR_CHECKENTRY2_A (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FGOODSID BIGINT DEFAULT 0 NOT NULL,
FGOODSDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FBASICUNITID BIGINT DEFAULT 0 NOT NULL,
FBASICQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSTUNITID BIGINT DEFAULT 0 NOT NULL,
FASSTQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FACTPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FACTTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPOBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPOENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSUMINVQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMINVAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FINVOICEID VARCHAR(50) DEFAULT ' ' NOT NULL,
FACTBILLNO VARCHAR(50) DEFAULT ' ' NOT NULL,
FENTRYEXCHRATE DECIMAL(23,10) DEFAULT 1 NOT NULL,
FENTRYLOCCURR BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_ORDER_L') 
 CREATE TABLE T_PUR_ORDER_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(512) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_REQUEST_L') 
 CREATE TABLE T_PUR_REQUEST_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(512) DEFAULT ' ' NOT NULL,
FSUPADDR NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_COMPCNENT_L') 
 CREATE TABLE T_PUR_COMPCNENT_L (
FPKID NVARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(200) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_REQUESTASENTRY') 
 CREATE TABLE T_PUR_REQUESTASENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FAFSERVICEBILLID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_ORDCHANGE_L') 
 CREATE TABLE T_PUR_ORDCHANGE_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(512) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_REQUESTENTRY_A') 
 CREATE TABLE T_PUR_REQUESTENTRY_A (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FGOODSID BIGINT DEFAULT 0 NOT NULL,
FGOODSDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FBASICUNITID BIGINT DEFAULT 0 NOT NULL,
FBASICQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSTUNITID BIGINT DEFAULT 0 NOT NULL,
FASSTQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FACTPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FACTTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPOBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPOENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSUMRETURNQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FRETURNTYPE VARCHAR(10) DEFAULT ' ' NOT NULL,
FSHOPRETTYPE VARCHAR(10) DEFAULT ' ' NOT NULL,
FJDCHILDORDERID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPICKWARETYPE VARCHAR(10) DEFAULT ' ' NOT NULL,
FRETREASONCODE VARCHAR(10) DEFAULT ' ' NOT NULL,
FSERVICETIME VARCHAR(50) DEFAULT ' ' NOT NULL,
FECORDER BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_THIRDCHECKORDER') 
 CREATE TABLE T_PUR_THIRDCHECKORDER (
FID BIGINT DEFAULT 0 NOT NULL,
FCHILDBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLDATE DATETIME,
FPURORGID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FCURRID BIGINT DEFAULT 0 NOT NULL,
FSUMTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMSETTLEAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMSALOUTAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMDIFFAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FCHECKSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FPAYMENTBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FTHIRDORDERID BIGINT DEFAULT 0 NOT NULL,
FINVOICESTATE NVARCHAR(10) DEFAULT ' ' NOT NULL,
FREQORGID BIGINT DEFAULT 0 NOT NULL,
FRCVORGID BIGINT DEFAULT 0 NOT NULL,
FMALBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FREQPERSONID BIGINT DEFAULT 0 NOT NULL,
FRCVPERSONID BIGINT DEFAULT 0 NOT NULL,
FPERSONID BIGINT DEFAULT 0 NOT NULL,
FBUSINESSTYPEID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_THIRDDATAENTRY') 
 CREATE TABLE T_PUR_THIRDDATAENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FBILLDATE DATETIME,
FORDERAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FUNPAYAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FRETURNAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FRETURNSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCHILDORDER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPARENTORDER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FCHECKSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FPLATFORM NVARCHAR(10) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_THIRDDATA') 
 CREATE TABLE T_PUR_THIRDDATA (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FSTARTDATE DATETIME,
FENDDATE DATETIME,
FORGID BIGINT DEFAULT 0 NOT NULL,
FSOURCE NVARCHAR(10) DEFAULT ' ' NOT NULL,
FCURRID BIGINT DEFAULT 0 NOT NULL,
FLOCCURRID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_PAY_L') 
 CREATE TABLE T_PUR_PAY_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(512) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_RETURN_L') 
 CREATE TABLE T_PUR_RETURN_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(512) DEFAULT ' ' NOT NULL,
FSUPADDR NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_PAYAPPLYENTRY') 
 CREATE TABLE T_PUR_PAYAPPLYENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FSETTLETYPEID BIGINT DEFAULT 0 NOT NULL,
FPURPOSE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDUEDATE DATETIME,
FEXPECTDATE DATETIME,
FPAYAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FAPPLYAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FAPPROVEAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPAYEEACC VARCHAR(50) DEFAULT ' ' NOT NULL,
FPAYEEBANK VARCHAR(50) DEFAULT ' ' NOT NULL,
FNOTE NVARCHAR(512) DEFAULT ' ' NOT NULL,
FREQORGID BIGINT DEFAULT 0 NOT NULL,
FPURORGID BIGINT DEFAULT 0 NOT NULL,
FRCVORGID BIGINT DEFAULT 0 NOT NULL,
FSETTLEORGID BIGINT DEFAULT 0 NOT NULL,
FPAYORGID BIGINT DEFAULT 0 NOT NULL,
FPCBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPOBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPROJECTID BIGINT DEFAULT 0 NOT NULL,
FTRACEID BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FASSTPROID VARCHAR(50) DEFAULT ' ' NOT NULL,
FENTRYSTATUS CHAR(1) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_INSTOCK_L') 
 CREATE TABLE T_PUR_INSTOCK_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(512) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_RECEIPT_L') 
 CREATE TABLE T_PUR_RECEIPT_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(512) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_CHECK_L') 
 CREATE TABLE T_PUR_CHECK_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(512) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_INVOICE_L') 
 CREATE TABLE T_PUR_INVOICE_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(512) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_PAYAPPLY_L') 
 CREATE TABLE T_PUR_PAYAPPLY_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(512) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_CHECKENTRY') 
 CREATE TABLE T_PUR_CHECKENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FMATERIALDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FASSTPROID VARCHAR(50) DEFAULT ' ' NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FOUTQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FINQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FDIFFQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FOUTTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FINTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FDIFFAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDCTRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FDCTAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FISPRESENT CHAR(1) DEFAULT ' ' NOT NULL,
FOUTBILLNO NVARCHAR(255) DEFAULT ' ' NOT NULL,
FOUTBILLDATE DATETIME,
FINBILLNO NVARCHAR(255) DEFAULT ' ' NOT NULL,
FNOTE NVARCHAR(512) DEFAULT ' ' NOT NULL,
FENTRYSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FPOBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPCBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPROJECTID BIGINT DEFAULT 0 NOT NULL,
FTRACEID BIGINT DEFAULT 0 NOT NULL,
FREQORGID BIGINT DEFAULT 0 NOT NULL,
FPURORGID BIGINT DEFAULT 0 NOT NULL,
FRCVORGID BIGINT DEFAULT 0 NOT NULL,
FSETTLEORGID BIGINT DEFAULT 0 NOT NULL,
FPAYORGID BIGINT DEFAULT 0 NOT NULL,
FTAXRATEID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_CHECKINVOICE') 
 CREATE TABLE T_PUR_CHECKINVOICE (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FINVOICECODE VARCHAR(255) DEFAULT ' ' NOT NULL,
FINVOICENO VARCHAR(255) DEFAULT ' ' NOT NULL,
FINVOICEDATE DATETIME,
FINVOICEAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FNOTE NVARCHAR(512) DEFAULT ' ' NOT NULL,
FENTRYSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FINVOICEID VARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_SALRETURN_L') 
 CREATE TABLE T_PUR_SALRETURN_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(512) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_SALOUTSTOCK_L') 
 CREATE TABLE T_PUR_SALOUTSTOCK_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(512) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_SALRETURNENTRY') 
 CREATE TABLE T_PUR_SALRETURNENTRY (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FMATERIALDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FASSTPROID VARCHAR(50) DEFAULT ' ' NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDCTRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FDCTAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FISPRESENT CHAR(1) DEFAULT ' ' NOT NULL,
FREQORGID BIGINT DEFAULT 0 NOT NULL,
FPURORGID BIGINT DEFAULT 0 NOT NULL,
FRCVORGID BIGINT DEFAULT 0 NOT NULL,
FSETTLEORGID BIGINT DEFAULT 0 NOT NULL,
FPAYORGID BIGINT DEFAULT 0 NOT NULL,
FNOTE NVARCHAR(512) DEFAULT ' ' NOT NULL,
FENTRYSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCHECKSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FPOBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPCBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPROJECTID BIGINT DEFAULT 0 NOT NULL,
FTRACEID BIGINT DEFAULT 0 NOT NULL,
FLOTID BIGINT DEFAULT 0 NOT NULL,
FSUPLOT NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPRODDATE DATETIME,
FDUEDATE DATETIME,
FRETREASON NVARCHAR(512) DEFAULT ' ' NOT NULL,
FTAXRATEID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_PAY_A') 
 CREATE TABLE T_PUR_PAY_A (
FID 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,
FAUDITDATE DATETIME,
FCFMID BIGINT DEFAULT 0 NOT NULL,
FCFMDATE DATETIME,
FORIGIN CHAR(1) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(512) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_PAYAPPLY_A') 
 CREATE TABLE T_PUR_PAYAPPLY_A (
FID 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,
FAUDITDATE DATETIME,
FCFMID BIGINT DEFAULT 0 NOT NULL,
FCFMDATE DATETIME,
FORIGIN CHAR(1) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(512) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_RECEIVE_A') 
 CREATE TABLE T_PUR_RECEIVE_A (
FID 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,
FAUDITDATE DATETIME,
FCFMID BIGINT DEFAULT 0 NOT NULL,
FCFMDATE DATETIME,
FORIGIN CHAR(1) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_OUTSTOCK_A') 
 CREATE TABLE T_PUR_OUTSTOCK_A (
FID 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,
FAUDITDATE DATETIME,
FCFMID BIGINT DEFAULT 0 NOT NULL,
FCFMDATE DATETIME,
FORIGIN CHAR(1) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_OUTTRAN_A') 
 CREATE TABLE T_PUR_OUTTRAN_A (
FID 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,
FAUDITDATE DATETIME,
FCFMID BIGINT DEFAULT 0 NOT NULL,
FCFMDATE DATETIME,
FORIGIN CHAR(1) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_PLAN_A') 
 CREATE TABLE T_PUR_PLAN_A (
FID 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,
FAUDITDATE DATETIME,
FCFMID BIGINT DEFAULT 0 NOT NULL,
FCFMDATE DATETIME,
FORIGIN CHAR(1) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_SETTLE') 
 CREATE TABLE T_PUR_SETTLE (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FBILLDATE DATETIME,
FBIZTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FINVORGID BIGINT DEFAULT 0 NOT NULL,
FUSEORGID BIGINT DEFAULT 0 NOT NULL,
FSETTLEORGID BIGINT DEFAULT 0 NOT NULL,
FPERSONID BIGINT DEFAULT 0 NOT NULL,
FDATEFROM DATETIME,
FDATETO DATETIME,
FPAYCONDID BIGINT DEFAULT 0 NOT NULL,
FSETTLETYPEID BIGINT DEFAULT 0 NOT NULL,
FCURRID BIGINT DEFAULT 0 NOT NULL,
FTAXTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FLOCCURRID BIGINT DEFAULT 0 NOT NULL,
FEXCHTYPEID BIGINT DEFAULT 0 NOT NULL,
FEXCHRATE DECIMAL(19,6) DEFAULT 1 NOT NULL,
FSUMAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FBILLSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCFMSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FBIZPARTNERID BIGINT DEFAULT 0 NOT NULL,
FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_OUTRETURN_A') 
 CREATE TABLE T_PUR_OUTRETURN_A (
FID 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,
FAUDITDATE DATETIME,
FCFMID BIGINT DEFAULT 0 NOT NULL,
FCFMDATE DATETIME,
FORIGIN CHAR(1) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_REPLENISH_A') 
 CREATE TABLE T_PUR_REPLENISH_A (
FID 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,
FAUDITDATE DATETIME,
FCFMID BIGINT DEFAULT 0 NOT NULL,
FCFMDATE DATETIME,
FORIGIN CHAR(1) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_CONTRACT_A') 
 CREATE TABLE T_PUR_CONTRACT_A (
FID 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,
FAUDITDATE DATETIME,
FCFMID BIGINT DEFAULT 0 NOT NULL,
FCFMDATE DATETIME,
FORIGIN CHAR(1) DEFAULT ' ' NOT NULL,
FBILLVERSION NVARCHAR(50) DEFAULT ' ' NOT NULL,
FTEMPLATEID BIGINT DEFAULT 0 NOT NULL,
FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_CONCHANGE_A') 
 CREATE TABLE T_PUR_CONCHANGE_A (
FID 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,
FAUDITDATE DATETIME,
FCFMID BIGINT DEFAULT 0 NOT NULL,
FCFMDATE DATETIME,
FORIGIN CHAR(1) DEFAULT ' ' NOT NULL,
FPCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_APPLY_A') 
 CREATE TABLE T_PUR_APPLY_A (
FID 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,
FAUDITDATE DATETIME,
FCFMID BIGINT DEFAULT 0 NOT NULL,
FCFMDATE DATETIME,
FORIGIN CHAR(1) DEFAULT ' ' NOT NULL,
FSRCBILLTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_SALRETURN_A') 
 CREATE TABLE T_PUR_SALRETURN_A (
FID 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,
FAUDITDATE DATETIME,
FCFMID BIGINT DEFAULT 0 NOT NULL,
FCFMDATE DATETIME,
FORIGIN CHAR(1) DEFAULT ' ' NOT NULL,
FSUPADDR NVARCHAR(255) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(512) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_SALOUTSTOCK_A') 
 CREATE TABLE T_PUR_SALOUTSTOCK_A (
FID 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,
FAUDITDATE DATETIME,
FCFMID BIGINT DEFAULT 0 NOT NULL,
FCFMDATE DATETIME,
FORIGIN CHAR(1) DEFAULT ' ' NOT NULL,
FSRCBILLTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FISINITIAL CHAR(1) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(512) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_RECEIPT_A') 
 CREATE TABLE T_PUR_RECEIPT_A (
FID 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,
FAUDITDATE DATETIME,
FCFMID BIGINT DEFAULT 0 NOT NULL,
FCFMDATE DATETIME,
FORIGIN CHAR(1) DEFAULT ' ' NOT NULL,
FISCHECK CHAR(1) DEFAULT ' ' NOT NULL,
FCHKBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FISRETURN CHAR(1) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(512) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_RETURN_A') 
 CREATE TABLE T_PUR_RETURN_A (
FID 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,
FAUDITDATE DATETIME,
FCFMID BIGINT DEFAULT 0 NOT NULL,
FCFMDATE DATETIME,
FORIGIN CHAR(1) DEFAULT ' ' NOT NULL,
FISINITIAL CHAR(1) DEFAULT ' ' NOT NULL,
FPRICETIME CHAR(1) DEFAULT ' ' NOT NULL,
FSUPADDR NVARCHAR(255) DEFAULT ' ' NOT NULL,
FISCHECK CHAR(1) DEFAULT ' ' NOT NULL,
FCHKBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FISVIRTUAL CHAR(1) DEFAULT ' ' NOT NULL,
FISCENTERSETTLE CHAR(1) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(512) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_EXIAPI') 
 CREATE TABLE T_PUR_EXIAPI (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FENABLE CHAR(1) DEFAULT ' ' NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_REQUEST_A') 
 CREATE TABLE T_PUR_REQUEST_A (
FID 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,
FAUDITDATE DATETIME,
FCFMID BIGINT DEFAULT 0 NOT NULL,
FCFMDATE DATETIME,
FORIGIN CHAR(1) DEFAULT ' ' NOT NULL,
FSUPADDR NVARCHAR(255) DEFAULT ' ' NOT NULL,
FJDSERVICEID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FMALORDERNO VARCHAR(50) DEFAULT ' ' NOT NULL,
FECSOURCE NVARCHAR(80) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(512) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_ORDCHANGE_A') 
 CREATE TABLE T_PUR_ORDCHANGE_A (
FID 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,
FAUDITDATE DATETIME,
FCFMID BIGINT DEFAULT 0 NOT NULL,
FCFMDATE DATETIME,
FSUGGESTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FORIGIN CHAR(1) DEFAULT ' ' NOT NULL,
FPOBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSOURCEBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(512) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_RECEIVE') 
 CREATE TABLE T_PUR_RECEIVE (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FBIZTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FBILLDATE DATETIME,
FDELIDATE DATETIME,
FDELIADDR NVARCHAR(255) DEFAULT ' ' NOT NULL,
FREQORGID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FRCVORGID BIGINT DEFAULT 0 NOT NULL,
FSETTLEORGID BIGINT DEFAULT 0 NOT NULL,
FPAYORGID BIGINT DEFAULT 0 NOT NULL,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FDELISUPID BIGINT DEFAULT 0 NOT NULL,
FINVOICESUPID BIGINT DEFAULT 0 NOT NULL,
FPAYEESUPID BIGINT DEFAULT 0 NOT NULL,
FPERSONID BIGINT DEFAULT 0 NOT NULL,
FCONTACTERID BIGINT DEFAULT 0 NOT NULL,
FPAYCONDID BIGINT DEFAULT 0 NOT NULL,
FSETTLETYPEID BIGINT DEFAULT 0 NOT NULL,
FCURRID BIGINT DEFAULT 0 NOT NULL,
FLOCCURRID BIGINT DEFAULT 0 NOT NULL,
FEXCHTYPEID BIGINT DEFAULT 0 NOT NULL,
FEXCHRATE DECIMAL(19,6) DEFAULT 1 NOT NULL,
FTAXTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FSUMAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FBILLSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCFMSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FBIZPARTNERID BIGINT DEFAULT 0 NOT NULL,
FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_PAYAPPLY') 
 CREATE TABLE T_PUR_PAYAPPLY (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FBIZTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FBILLDATE DATETIME,
FEXPECTDATE DATETIME,
FREQORGID BIGINT DEFAULT 0 NOT NULL,
FPURORGID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FSETTLEORGID BIGINT DEFAULT 0 NOT NULL,
FPAYORGID BIGINT DEFAULT 0 NOT NULL,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FDELISUPID BIGINT DEFAULT 0 NOT NULL,
FINVOICESUPID BIGINT DEFAULT 0 NOT NULL,
FPAYEESUPID BIGINT DEFAULT 0 NOT NULL,
FPERSONID BIGINT DEFAULT 0 NOT NULL,
FCONTACTERID BIGINT DEFAULT 0 NOT NULL,
FSUMPAYAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMAPPLYAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMAPPROVEAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSETTLETYPEID BIGINT DEFAULT 0 NOT NULL,
FPAYCONDID BIGINT DEFAULT 0 NOT NULL,
FCURRID BIGINT DEFAULT 0 NOT NULL,
FLOCCURRID BIGINT DEFAULT 0 NOT NULL,
FEXCHTYPEID BIGINT DEFAULT 0 NOT NULL,
FEXCHRATE DECIMAL(19,6) DEFAULT 1 NOT NULL,
FTAXTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FBILLSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCFMSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FBIZPARTNERID BIGINT DEFAULT 0 NOT NULL,
FREMARK NVARCHAR(512) DEFAULT ' ' NOT NULL,
FLASTUPDATEUSERID BIGINT DEFAULT 0 NOT NULL,
FLASTUPDATETIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_CONCHANGE') 
 CREATE TABLE T_PUR_CONCHANGE (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FBILLDATE DATETIME,
FBIZTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FPERSONID BIGINT DEFAULT 0 NOT NULL,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FCHGREASONID INT DEFAULT 0 NOT NULL,
FDATEFROM DATETIME,
FDATETO DATETIME,
FSETTLETYPEID BIGINT DEFAULT 0 NOT NULL,
FPAYCONDID BIGINT DEFAULT 0 NOT NULL,
FCURRID BIGINT DEFAULT 0 NOT NULL,
FEXCHRATE DECIMAL(19,6) DEFAULT 1 NOT NULL,
FTAXTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FBILLSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCFMSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FBIZPARTNERID BIGINT DEFAULT 0 NOT NULL,
FPCBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_OUTTRAN') 
 CREATE TABLE T_PUR_OUTTRAN (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FBILLDATE DATETIME,
FBIZTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FINVORGID BIGINT DEFAULT 0 NOT NULL,
FPERSONID BIGINT DEFAULT 0 NOT NULL,
FPAYCONDID BIGINT DEFAULT 0 NOT NULL,
FSETTLETYPEID BIGINT DEFAULT 0 NOT NULL,
FCURRID BIGINT DEFAULT 0 NOT NULL,
FLOCCURRID BIGINT DEFAULT 0 NOT NULL,
FEXCHTYPEID BIGINT DEFAULT 0 NOT NULL,
FEXCHRATE DECIMAL(19,6) DEFAULT 1 NOT NULL,
FTAXTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FSUMAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FBILLSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCFMSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FBIZPARTNERID BIGINT DEFAULT 0 NOT NULL,
FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_OUTSTOCK') 
 CREATE TABLE T_PUR_OUTSTOCK (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FBILLDATE DATETIME,
FBIZTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FOUTORGID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FPERSONID BIGINT DEFAULT 0 NOT NULL,
FPAYCONDID BIGINT DEFAULT 0 NOT NULL,
FSETTLETYPEID BIGINT DEFAULT 0 NOT NULL,
FCURRID BIGINT DEFAULT 0 NOT NULL,
FLOCCURRID BIGINT DEFAULT 0 NOT NULL,
FEXCHTYPEID BIGINT DEFAULT 0 NOT NULL,
FEXCHRATE DECIMAL(19,6) DEFAULT 1 NOT NULL,
FTAXTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FSUMAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FBILLSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCFMSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FBIZPARTNERID BIGINT DEFAULT 0 NOT NULL,
FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_PLAN') 
 CREATE TABLE T_PUR_PLAN (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FBILLDATE DATETIME,
FBIZTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FPERSONID BIGINT DEFAULT 0 NOT NULL,
FBILLSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCFMSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FBIZPARTNERID BIGINT DEFAULT 0 NOT NULL,
FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_APPLY') 
 CREATE TABLE T_PUR_APPLY (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FBIZTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FBILLDATE DATETIME,
FORGID BIGINT DEFAULT 0 NOT NULL,
FPERSONID BIGINT DEFAULT 0 NOT NULL,
FDELIDATE DATETIME,
FDELIADDR NVARCHAR(255) DEFAULT ' ' NOT NULL,
FREQORGID BIGINT DEFAULT 0 NOT NULL,
FPURORGID BIGINT DEFAULT 0 NOT NULL,
FPURPERSONID BIGINT DEFAULT 0 NOT NULL,
FRCVORGID BIGINT DEFAULT 0 NOT NULL,
FSETTLEORGID BIGINT DEFAULT 0 NOT NULL,
FPAYORGID BIGINT DEFAULT 0 NOT NULL,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FDELISUPID BIGINT DEFAULT 0 NOT NULL,
FINVOICESUPID BIGINT DEFAULT 0 NOT NULL,
FPAYEESUPID BIGINT DEFAULT 0 NOT NULL,
FCONTACTERID BIGINT DEFAULT 0 NOT NULL,
FPAYCONDID BIGINT DEFAULT 0 NOT NULL,
FSETTLETYPEID BIGINT DEFAULT 0 NOT NULL,
FCURRID BIGINT DEFAULT 0 NOT NULL,
FLOCCURRID BIGINT DEFAULT 0 NOT NULL,
FEXCHTYPEID BIGINT DEFAULT 0 NOT NULL,
FEXCHRATE DECIMAL(19,6) DEFAULT 1 NOT NULL,
FTAXTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FSUMAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FBILLSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCFMSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FBIZPARTNERID BIGINT DEFAULT 0 NOT NULL,
FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_PAY') 
 CREATE TABLE T_PUR_PAY (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FBIZTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FBILLDATE DATETIME,
FREQORGID BIGINT DEFAULT 0 NOT NULL,
FPURORGID BIGINT DEFAULT 0 NOT NULL,
FRCVORGID BIGINT DEFAULT 0 NOT NULL,
FSETTLEORGID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FDELISUPID BIGINT DEFAULT 0 NOT NULL,
FINVOICESUPID BIGINT DEFAULT 0 NOT NULL,
FPAYEESUPID BIGINT DEFAULT 0 NOT NULL,
FPERSONID BIGINT DEFAULT 0 NOT NULL,
FCONTACTERID BIGINT DEFAULT 0 NOT NULL,
FPAYBANKID BIGINT DEFAULT 0 NOT NULL,
FPAYACCID BIGINT DEFAULT 0 NOT NULL,
FPAYEEBANKID BIGINT DEFAULT 0 NOT NULL,
FPAYEEACCID BIGINT DEFAULT 0 NOT NULL,
FPAYBANK VARCHAR(100) DEFAULT ' ' NOT NULL,
FPAYACC VARCHAR(50) DEFAULT ' ' NOT NULL,
FPAYEEBANK VARCHAR(100) DEFAULT ' ' NOT NULL,
FPAYEEACC VARCHAR(50) DEFAULT ' ' NOT NULL,
FSETTLENO VARCHAR(50) DEFAULT ' ' NOT NULL,
FPAYCONDID BIGINT DEFAULT 0 NOT NULL,
FSETTLETYPEID BIGINT DEFAULT 0 NOT NULL,
FCURRID BIGINT DEFAULT 0 NOT NULL,
FLOCCURRID BIGINT DEFAULT 0 NOT NULL,
FEXCHTYPEID BIGINT DEFAULT 0 NOT NULL,
FEXCHRATE DECIMAL(19,6) DEFAULT 1 NOT NULL,
FTAXTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FSUMAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FFEE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMDCTAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMPAYAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FBILLSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCFMSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FBIZPARTNERID BIGINT DEFAULT 0 NOT NULL,
FREMARK NVARCHAR(512) DEFAULT ' ' NOT NULL,
FLASTUPDATEUSERID BIGINT DEFAULT 0 NOT NULL,
FLASTUPDATETIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_OUTRETURN') 
 CREATE TABLE T_PUR_OUTRETURN (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FBILLDATE DATETIME,
FBIZTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FOUTORGID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FPERSONID BIGINT DEFAULT 0 NOT NULL,
FPAYCONDID BIGINT DEFAULT 0 NOT NULL,
FSETTLETYPEID BIGINT DEFAULT 0 NOT NULL,
FCURRID BIGINT DEFAULT 0 NOT NULL,
FLOCCURRID BIGINT DEFAULT 0 NOT NULL,
FEXCHTYPEID BIGINT DEFAULT 0 NOT NULL,
FEXCHRATE DECIMAL(19,6) DEFAULT 1 NOT NULL,
FTAXTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FSUMAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FBILLSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCFMSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FBIZPARTNERID BIGINT DEFAULT 0 NOT NULL,
FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_REPLENISH') 
 CREATE TABLE T_PUR_REPLENISH (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FBILLDATE DATETIME,
FBIZTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FINVORGID BIGINT DEFAULT 0 NOT NULL,
FBILLSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCFMSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FBIZPARTNERID BIGINT DEFAULT 0 NOT NULL,
FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_SALOUTSTOCK') 
 CREATE TABLE T_PUR_SALOUTSTOCK (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FBUSINESSTYPEID BIGINT DEFAULT 0 NOT NULL,
FBIZTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FBILLDATE DATETIME,
FDELIDATE DATETIME,
FDELIADDR NVARCHAR(255) DEFAULT ' ' NOT NULL,
FREQORGID BIGINT DEFAULT 0 NOT NULL,
FPURORGID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FSETTLEORGID BIGINT DEFAULT 0 NOT NULL,
FPAYORGID BIGINT DEFAULT 0 NOT NULL,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FDELISUPID BIGINT DEFAULT 0 NOT NULL,
FINVOICESUPID BIGINT DEFAULT 0 NOT NULL,
FPAYEESUPID BIGINT DEFAULT 0 NOT NULL,
FPERSONID BIGINT DEFAULT 0 NOT NULL,
FCONTACTERID BIGINT DEFAULT 0 NOT NULL,
FPAYCONDID BIGINT DEFAULT 0 NOT NULL,
FSETTLETYPEID BIGINT DEFAULT 0 NOT NULL,
FCURRID BIGINT DEFAULT 0 NOT NULL,
FLOCCURRID BIGINT DEFAULT 0 NOT NULL,
FEXCHTYPEID BIGINT DEFAULT 0 NOT NULL,
FEXCHRATE DECIMAL(19,6) DEFAULT 1 NOT NULL,
FTAXTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FSUMAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FBILLSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCFMSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FLOGSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FBIZPARTNERID BIGINT DEFAULT 0 NOT NULL,
FREMARK NVARCHAR(512) DEFAULT ' ' NOT NULL,
FLASTUPDATEUSERID BIGINT DEFAULT 0 NOT NULL,
FLASTUPDATETIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_ORDCHANGE') 
 CREATE TABLE T_PUR_ORDCHANGE (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FBUSINESSTYPEID BIGINT DEFAULT 0 NOT NULL,
FBIZTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FBILLDATE DATETIME,
FPOBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FCHGREASONID BIGINT DEFAULT 0 NOT NULL,
FDELIDATE DATETIME,
FDELIADDR NVARCHAR(255) DEFAULT ' ' NOT NULL,
FREQORGID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FRCVORGID BIGINT DEFAULT 0 NOT NULL,
FSETTLEORGID BIGINT DEFAULT 0 NOT NULL,
FPAYORGID BIGINT DEFAULT 0 NOT NULL,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FDELISUPID BIGINT DEFAULT 0 NOT NULL,
FINVOICESUPID BIGINT DEFAULT 0 NOT NULL,
FPAYEESUPID BIGINT DEFAULT 0 NOT NULL,
FPERSONID BIGINT DEFAULT 0 NOT NULL,
FCONTACTERID BIGINT DEFAULT 0 NOT NULL,
FPAYCONDID BIGINT DEFAULT 0 NOT NULL,
FSETTLETYPEID BIGINT DEFAULT 0 NOT NULL,
FCURRID BIGINT DEFAULT 0 NOT NULL,
FLOCCURRID BIGINT DEFAULT 0 NOT NULL,
FEXCHTYPEID BIGINT DEFAULT 0 NOT NULL,
FEXCHRATE DECIMAL(19,6) DEFAULT 1 NOT NULL,
FTAXTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FSUMAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FCENTERSETTLE CHAR(1) DEFAULT ' ' NOT NULL,
FBILLSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCFMSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FBIZPARTNERID BIGINT DEFAULT 0 NOT NULL,
FREASON NVARCHAR(512) DEFAULT ' ',
FREMARK NVARCHAR(512) DEFAULT ' ' NOT NULL,
FLASTUPDATEUSERID BIGINT DEFAULT 0 NOT NULL,
FLASTUPDATETIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_ORDER') 
 CREATE TABLE T_PUR_ORDER (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FBIZTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FBUSINESSTYPEID BIGINT DEFAULT 0 NOT NULL,
FBILLDATE DATETIME,
FDELIDATE DATETIME,
FDELIADDR NVARCHAR(255) DEFAULT ' ' NOT NULL,
FREQORGID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FRCVORGID BIGINT DEFAULT 0 NOT NULL,
FSETTLEORGID BIGINT DEFAULT 0 NOT NULL,
FPAYORGID BIGINT DEFAULT 0 NOT NULL,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FDELISUPID BIGINT DEFAULT 0 NOT NULL,
FINVOICESUPID BIGINT DEFAULT 0 NOT NULL,
FPAYEESUPID BIGINT DEFAULT 0 NOT NULL,
FPERSONID BIGINT DEFAULT 0 NOT NULL,
FCONTACTERID BIGINT DEFAULT 0 NOT NULL,
FPAYCONDID BIGINT DEFAULT 0 NOT NULL,
FSETTLETYPEID BIGINT DEFAULT 0 NOT NULL,
FCURRID BIGINT DEFAULT 0 NOT NULL,
FLOCCURRID BIGINT DEFAULT 0 NOT NULL,
FEXCHTYPEID BIGINT DEFAULT 0 NOT NULL,
FEXCHRATE DECIMAL(19,6) DEFAULT 1 NOT NULL,
FTAXTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FSUMAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FCENTERSETTLE CHAR(1) DEFAULT ' ' NOT NULL,
FPREPAYRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMPREPAYAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMPAYABLEAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMINVOICEAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMPAYAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FBILLSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCFMSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FLOGSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FPAYSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FBIZPARTNERID BIGINT DEFAULT 0 NOT NULL,
FREQPERSONID BIGINT DEFAULT 0 NOT NULL,
FSUPGROUPID BIGINT DEFAULT 0 NOT NULL,
FISSYN CHAR(1) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(512) DEFAULT ' ' NOT NULL,
FLASTUPDATEUSERID BIGINT DEFAULT 0 NOT NULL,
FLASTUPDATETIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_SALRETURN') 
 CREATE TABLE T_PUR_SALRETURN (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FBIZTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FBILLDATE DATETIME,
FREQORGID BIGINT DEFAULT 0 NOT NULL,
FPURORGID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FSETTLEORGID BIGINT DEFAULT 0 NOT NULL,
FPAYORGID BIGINT DEFAULT 0 NOT NULL,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FDELISUPID BIGINT DEFAULT 0 NOT NULL,
FINVOICESUPID BIGINT DEFAULT 0 NOT NULL,
FPAYEESUPID BIGINT DEFAULT 0 NOT NULL,
FPERSONID BIGINT DEFAULT 0 NOT NULL,
FCONTACTERID BIGINT DEFAULT 0 NOT NULL,
FPAYCONDID BIGINT DEFAULT 0 NOT NULL,
FSETTLETYPEID BIGINT DEFAULT 0 NOT NULL,
FCURRID BIGINT DEFAULT 0 NOT NULL,
FLOCCURRID BIGINT DEFAULT 0 NOT NULL,
FEXCHTYPEID BIGINT DEFAULT 0 NOT NULL,
FEXCHRATE DECIMAL(19,6) DEFAULT 1 NOT NULL,
FTAXTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FSUMAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FBILLSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCFMSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FBIZPARTNERID BIGINT DEFAULT 0 NOT NULL,
FREPLENISHTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(512) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_CONTRACT') 
 CREATE TABLE T_PUR_CONTRACT (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FBIZTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FBILLDATE DATETIME,
FDATEFROM DATETIME,
FDATETO DATETIME,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FPERSONID BIGINT DEFAULT 0 NOT NULL,
FPAYCONDID BIGINT DEFAULT 0 NOT NULL,
FSETTLETYPEID BIGINT DEFAULT 0 NOT NULL,
FCURRID BIGINT DEFAULT 0 NOT NULL,
FLOCCURRID BIGINT DEFAULT 0 NOT NULL,
FEXCHTYPEID BIGINT DEFAULT 0 NOT NULL,
FEXCHRATE DECIMAL(19,6) DEFAULT 1 NOT NULL,
FTAXTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FSUMTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FBILLSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCFMSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FBIZPARTNERID BIGINT DEFAULT 0 NOT NULL,
FBILLNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_INVOICEDETAIL_ATT') 
 CREATE TABLE T_PUR_INVOICEDETAIL_ATT (
FPKID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_INVOICEDETAIL') 
 CREATE TABLE T_PUR_INVOICEDETAIL (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FINVCODE VARCHAR(255) DEFAULT ' ' NOT NULL,
FINVNO VARCHAR(255) DEFAULT ' ' NOT NULL,
FINVDATE DATETIME,
FINVADDR VARCHAR(511) DEFAULT ' ' NOT NULL,
FINVID VARCHAR(255) DEFAULT ' ' NOT NULL,
FINVSERIALNUM VARCHAR(255) DEFAULT ' ' NOT NULL,
FINVAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FINVOICEAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FINVTAX DECIMAL(23,10) DEFAULT 0 NOT NULL,
FINVREMARK NVARCHAR(512) DEFAULT ' ' NOT NULL,
FINVCHECKSTATUS VARCHAR(1) DEFAULT '3' NOT NULL,
FINVSOURCE VARCHAR(1) DEFAULT '1' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_SALOUTSTOCK_REJ') 
 CREATE TABLE T_PUR_SALOUTSTOCK_REJ (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FPOBILLNO NVARCHAR(255) DEFAULT ' ' NOT NULL,
FINBILLNO NVARCHAR(255) DEFAULT ' ' NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FREJDATE DATETIME,
FREJECTQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FREJECTREASON NVARCHAR(255) DEFAULT ' ' NOT NULL,
FPOENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPOBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_ORDCHANGENTRY_A') 
 CREATE TABLE T_PUR_ORDCHANGENTRY_A (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FQTYOLD DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPRICEOLD DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXPRICEOLD DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDCTRATEOLD DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXRATEOLD DECIMAL(19,6) DEFAULT 0 NOT NULL,
FDELIDATEOLD DATETIME,
FDELIADDROLD NVARCHAR(255) DEFAULT ' ' NOT NULL,
FGOODSID BIGINT DEFAULT 0 NOT NULL,
FGOODSDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FPOENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FTAXRATEIDOLD BIGINT DEFAULT 0 NOT NULL,
FSOURCEBILLENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPROMISEDAYOLD DATETIME
);



IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_INVOICENTRY2_A') 
 CREATE TABLE T_PUR_INVOICENTRY2_A (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FGOODSID BIGINT DEFAULT 0 NOT NULL,
FGOODSDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FBASICUNITID BIGINT DEFAULT 0 NOT NULL,
FBASICQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSTUNITID BIGINT DEFAULT 0 NOT NULL,
FASSTQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FACTPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FACTTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPOBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPOENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSUMPAYAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FINVOICEID VARCHAR(50) DEFAULT ' ' NOT NULL,
FISENTRYPAY CHAR(1) DEFAULT '2' NOT NULL,
FENTRYPAYTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FENTRYPAYBILLNO VARCHAR(80) DEFAULT ' ' NOT NULL,
FENTRYJDORDERID BIGINT DEFAULT 0 NOT NULL,
FECORDER VARCHAR(50) DEFAULT ' ' NOT NULL,
FENTRYEXCHRATE DECIMAL(23,10) DEFAULT 1 NOT NULL,
FENTRYLOCCURR BIGINT DEFAULT 1 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_INSTOCKENTRY') 
 CREATE TABLE T_PUR_INSTOCKENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FLINETYPEID BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FMATERIALNAMETEXT NVARCHAR(255) DEFAULT ' ' NOT NULL,
FMATERIALDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FASSTPROID VARCHAR(50) DEFAULT ' ' NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDCTRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FDCTAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FISPRESENT CHAR(1) DEFAULT ' ' NOT NULL,
FREQORGID BIGINT DEFAULT 0 NOT NULL,
FPURORGID BIGINT DEFAULT 0 NOT NULL,
FRCVORGID BIGINT DEFAULT 0 NOT NULL,
FSETTLEORGID BIGINT DEFAULT 0 NOT NULL,
FPAYORGID BIGINT DEFAULT 0 NOT NULL,
FWAREHOUSEID BIGINT DEFAULT 0 NOT NULL,
FLOCATIONID BIGINT DEFAULT 0 NOT NULL,
FNOTE NVARCHAR(512) DEFAULT ' ' NOT NULL,
FENTRYSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FPOBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPCBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPROJECTID BIGINT DEFAULT 0 NOT NULL,
FTRACEID BIGINT DEFAULT 0 NOT NULL,
FLOTID BIGINT DEFAULT 0 NOT NULL,
FSUPLOT NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPRODDATE DATETIME,
FDUEDATE DATETIME,
FTAXRATEID BIGINT DEFAULT 0 NOT NULL,
FLOTNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPODUNBILL NVARCHAR(80) DEFAULT ' ' NOT NULL,
FDUNID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_RECEIPTENTRY') 
 CREATE TABLE T_PUR_RECEIPTENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FLINETYPEID BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FMATERIALNAMETEXT NVARCHAR(255) DEFAULT ' ' NOT NULL,
FMATERIALDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FASSTPROID VARCHAR(50) DEFAULT ' ' NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDCTRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FDCTAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FISPRESENT CHAR(1) DEFAULT ' ' NOT NULL,
FWAREHOUSEID BIGINT DEFAULT 0 NOT NULL,
FSETTLEORGID BIGINT DEFAULT 0 NOT NULL,
FNOTE NVARCHAR(512) DEFAULT ' ' NOT NULL,
FENTRYSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FTRACEID BIGINT DEFAULT 0 NOT NULL,
FPOBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPCBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPROJECTID BIGINT DEFAULT 0 NOT NULL,
FLOTID BIGINT DEFAULT 0 NOT NULL,
FSUPLOT NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPRODDATE DATETIME,
FDUEDATE DATETIME,
FREQORGID BIGINT DEFAULT 0 NOT NULL,
FPURORGID BIGINT DEFAULT 0 NOT NULL,
FRCVORGID BIGINT DEFAULT 0 NOT NULL,
FPAYORGID BIGINT DEFAULT 0 NOT NULL,
FTAXRATEID BIGINT DEFAULT 0 NOT NULL,
FPODUNBILL NVARCHAR(80) DEFAULT ' ' NOT NULL,
FLOTNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FDUNID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_ORDERCHECK') 
 CREATE TABLE T_PUR_ORDERCHECK (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FGOODSID BIGINT DEFAULT 0 NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FSUMORDERQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMORDERAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMRCVQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMRCVAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMSENDQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMSENDAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMDIFFQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMDIFFAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FRCVNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FRCVQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FRCVAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FRCVDATE DATETIME,
FSENDNO NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSENDQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSENDAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSENDDATE DATETIME,
FDIFFQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FDIFFAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDCTRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FDCTAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMCHECKQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FRCVORGID BIGINT DEFAULT 0 NOT NULL,
FSETTLEORGID BIGINT DEFAULT 0 NOT NULL,
FPOBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPOENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FMATCHKEY VARCHAR(255) DEFAULT ' ' NOT NULL,
FPURTYPEID BIGINT DEFAULT 0 NOT NULL,
FCOSTITEMID BIGINT DEFAULT 0 NOT NULL,
FJDCHILDORDERID NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPAYCODEID NVARCHAR(80) DEFAULT ' ' NOT NULL,
FTAXRATEID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_INVOICE_LOG') 
 CREATE TABLE T_PUR_INVOICE_LOG (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FLOGBILLNO VARCHAR(80) DEFAULT ' ' NOT NULL,
FLOGDATE DATETIME,
FDELIDATE DATETIME,
FNOTE NVARCHAR(512) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_ORDER_LOG') 
 CREATE TABLE T_PUR_ORDER_LOG (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FLOGBILLNO VARCHAR(80) DEFAULT ' ' NOT NULL,
FLOGDATE DATETIME,
FDELIDATE DATETIME,
FNOTE NVARCHAR(512) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_INVOICENTRY') 
 CREATE TABLE T_PUR_INVOICENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FMATERIALDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FASSTPROID VARCHAR(50) DEFAULT ' ' NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDCTRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FDCTAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FISPRESENT CHAR(1) DEFAULT ' ' NOT NULL,
FDEDUCTIONTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FDEDUCTIONDATE DATETIME,
FTAXCODE VARCHAR(50) DEFAULT ' ' NOT NULL,
FISTAXPREF CHAR(1) DEFAULT ' ' NOT NULL,
FTAXPREFPOLICY NVARCHAR(255) DEFAULT ' ' NOT NULL,
FOUTBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FOUTBILLDATE DATETIME,
FCOSTID BIGINT DEFAULT 0 NOT NULL,
FNOTE NVARCHAR(512) DEFAULT ' ' NOT NULL,
FENTRYSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FPOBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPCBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPROJECTID BIGINT DEFAULT 0 NOT NULL,
FTRACEID BIGINT DEFAULT 0 NOT NULL,
FREQORGID BIGINT DEFAULT 0 NOT NULL,
FPURORGID BIGINT DEFAULT 0 NOT NULL,
FRCVORGID BIGINT DEFAULT 0 NOT NULL,
FSETTLEORGID BIGINT DEFAULT 0 NOT NULL,
FPAYORGID BIGINT DEFAULT 0 NOT NULL,
FTAXRATEID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_SALOUTSTOCK_LOG') 
 CREATE TABLE T_PUR_SALOUTSTOCK_LOG (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FLOGBILLNO VARCHAR(80) DEFAULT ' ' NOT NULL,
FLOGDATE DATETIME,
FDELIDATE DATETIME,
FNOTE NVARCHAR(512) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_ORDERENTRY') 
 CREATE TABLE T_PUR_ORDERENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FLINETYPEID BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FMATERIALNAMETEXT NVARCHAR(255) DEFAULT ' ' NOT NULL,
FMATERIALDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FASSTPROID VARCHAR(50) DEFAULT ' ' NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDCTRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FDCTAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FISPRESENT CHAR(1) DEFAULT ' ' NOT NULL,
FDELIDATE DATETIME,
FDELIADDR NVARCHAR(255) DEFAULT ' ' NOT NULL,
FREQORGID BIGINT DEFAULT 0 NOT NULL,
FPURORGID BIGINT DEFAULT 0 NOT NULL,
FRCVORGID BIGINT DEFAULT 0 NOT NULL,
FSETTLEORGID BIGINT DEFAULT 0 NOT NULL,
FPAYORGID BIGINT DEFAULT 0 NOT NULL,
FWAREHOUSEID BIGINT DEFAULT 0 NOT NULL,
FNOTE NVARCHAR(512) DEFAULT ' ' NOT NULL,
FROWLOGSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FENTRYSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FREQBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPOBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPCBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPROJECTID BIGINT DEFAULT 0 NOT NULL,
FTRACEID BIGINT DEFAULT 0 NOT NULL,
FTAXRATEID BIGINT DEFAULT 0 NOT NULL,
FPROMISEDAY DATETIME,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FEXECUTESCHEDULE BIGINT DEFAULT 0 NOT NULL,
FSCHEDULEDETAIL NVARCHAR(512) DEFAULT ' ' NOT NULL,
FEXECUTESDATE DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_ORDCHANGENTRY') 
 CREATE TABLE T_PUR_ORDCHANGENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FCHGTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FLINETYPEID BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FMATERIALNAMETEXT NVARCHAR(255) DEFAULT ' ' NOT NULL,
FMATERIALDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FASSTPROID VARCHAR(50) DEFAULT ' ' NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDCTRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FDCTAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FISPRESENT CHAR(1) DEFAULT ' ' NOT NULL,
FDELIDATE DATETIME,
FDELIADDR NVARCHAR(255) DEFAULT ' ' NOT NULL,
FRCVORGID BIGINT DEFAULT 0 NOT NULL,
FWAREHOUSEID BIGINT DEFAULT 0 NOT NULL,
FSETTLEORGID BIGINT DEFAULT 0 NOT NULL,
FPAYORGID BIGINT DEFAULT 0 NOT NULL,
FNOTE NVARCHAR(512) DEFAULT ' ' NOT NULL,
FENTRYSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FTAXRATEID BIGINT DEFAULT 0 NOT NULL,
FPROMISEDAY DATETIME,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_REQUESTENTRY') 
 CREATE TABLE T_PUR_REQUESTENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FLINETYPEID BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FMATERIALNAMETEXT NVARCHAR(255) DEFAULT ' ' NOT NULL,
FPURTYPEID BIGINT DEFAULT 0 NOT NULL,
FMATERIALDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FASSTPROID VARCHAR(50) DEFAULT ' ' NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDCTRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FDCTAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FISPRESENT CHAR(1) DEFAULT ' ' NOT NULL,
FREQORGID BIGINT DEFAULT 0 NOT NULL,
FPURORGID BIGINT DEFAULT 0 NOT NULL,
FINVORGID BIGINT DEFAULT 0 NOT NULL,
FSETTLEORGID BIGINT DEFAULT 0 NOT NULL,
FPAYORGID BIGINT DEFAULT 0 NOT NULL,
FWAREHOUSEID BIGINT DEFAULT 0 NOT NULL,
FNOTE NVARCHAR(512) DEFAULT ' ' NOT NULL,
FENTRYSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FPOBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPCBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPROJECTID BIGINT DEFAULT 0 NOT NULL,
FTRACEID BIGINT DEFAULT 0 NOT NULL,
FLOTID BIGINT DEFAULT 0 NOT NULL,
FSUPLOT NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPRODDATE DATETIME,
FDUEDATE DATETIME,
FREPLENISHQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FMATERIALNEWID BIGINT DEFAULT 0 NOT NULL,
FRETDATE DATETIME,
FRETREASON NVARCHAR(255) DEFAULT ' ' NOT NULL,
FTAXRATEID BIGINT DEFAULT 0 NOT NULL,
FLOTNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_RETURNENTRY') 
 CREATE TABLE T_PUR_RETURNENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FLINETYPEID BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FMATERIALNAMETEXT NVARCHAR(255) DEFAULT ' ' NOT NULL,
FMATERIALDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FASSTPROID VARCHAR(50) DEFAULT ' ' NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDCTRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FDCTAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FISPRESENT CHAR(1) DEFAULT ' ' NOT NULL,
FREQORGID BIGINT DEFAULT 0 NOT NULL,
FPURORGID BIGINT DEFAULT 0 NOT NULL,
FWAREHOUSEID BIGINT DEFAULT 0 NOT NULL,
FPAYORGID BIGINT DEFAULT 0 NOT NULL,
FSETTLEORGID BIGINT DEFAULT 0 NOT NULL,
FINVORGID BIGINT DEFAULT 0 NOT NULL,
FNOTE NVARCHAR(512) DEFAULT ' ' NOT NULL,
FENTRYSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FPOBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPCBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPROJECTID BIGINT DEFAULT 0 NOT NULL,
FTRACEID BIGINT DEFAULT 0 NOT NULL,
FLOTID BIGINT DEFAULT 0 NOT NULL,
FSUPLOT NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPRODDATE DATETIME,
FDUEDATE DATETIME,
FREPLENISHQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FMATERIALNEWID BIGINT DEFAULT 0 NOT NULL,
FRETREASON NVARCHAR(512) DEFAULT ' ' NOT NULL,
FTAXRATEID BIGINT DEFAULT 0 NOT NULL,
FPODUNBILL NVARCHAR(80) DEFAULT ' ' NOT NULL,
FDUNID BIGINT DEFAULT 0 NOT NULL,
FLOTNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_SALOUTSTOCKENTRY') 
 CREATE TABLE T_PUR_SALOUTSTOCKENTRY (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FLINETYPEID BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FMATERIALNAMETEXT NVARCHAR(255) DEFAULT ' ' NOT NULL,
FMATERIALDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FASSTPROID VARCHAR(50) DEFAULT ' ' NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDCTRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FDCTAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FISPRESENT CHAR(1) DEFAULT ' ' NOT NULL,
FDELIDATE DATETIME,
FDELIADDR NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSETTLEORGID BIGINT DEFAULT 0 NOT NULL,
FWAREHOUSEID BIGINT DEFAULT 0 NOT NULL,
FNOTE NVARCHAR(512) DEFAULT ' ' NOT NULL,
FPCBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPOBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPROJECTID BIGINT DEFAULT 0 NOT NULL,
FTRACEID BIGINT DEFAULT 0 NOT NULL,
FDUEDATE DATETIME,
FROWLOGSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FENTRYSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCHECKSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FLOTID BIGINT DEFAULT 0 NOT NULL,
FSUPLOT NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPRODDATE DATETIME,
FREQORGID BIGINT DEFAULT 0 NOT NULL,
FPURORGID BIGINT DEFAULT 0 NOT NULL,
FRCVORGID BIGINT DEFAULT 0 NOT NULL,
FPAYORGID BIGINT DEFAULT 0 NOT NULL,
FREJECTQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FREJECTREASON NVARCHAR(255) DEFAULT ' ' NOT NULL,
FTAXRATEID BIGINT DEFAULT 0 NOT NULL,
FPODUNBILL NVARCHAR(80) DEFAULT ' ' NOT NULL,
FDUNID BIGINT DEFAULT 0 NOT NULL,
FPROMISEDAY DATETIME,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_PAYENTRY') 
 CREATE TABLE T_PUR_PAYENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FDCTAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FFEEAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPAYAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FNOTE NVARCHAR(512) DEFAULT ' ' NOT NULL,
FREQORGID BIGINT DEFAULT 0 NOT NULL,
FPURORGID BIGINT DEFAULT 0 NOT NULL,
FRCVORGID BIGINT DEFAULT 0 NOT NULL,
FSETTLEORGID BIGINT DEFAULT 0 NOT NULL,
FPAYORGID BIGINT DEFAULT 0 NOT NULL,
FPCBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPOBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPROJECTID BIGINT DEFAULT 0 NOT NULL,
FTRACEID BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FASSTPROID VARCHAR(50) DEFAULT ' ' NOT NULL,
FENTRYSTATUS CHAR(1) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_REQUEST') 
 CREATE TABLE T_PUR_REQUEST (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FBUSINESSTYPEID BIGINT DEFAULT 0 NOT NULL,
FBIZTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FBILLDATE DATETIME,
FRETTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FREPLENISHTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FREQORGID BIGINT DEFAULT 0 NOT NULL,
FPURORGID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FSETTLEORGID BIGINT DEFAULT 0 NOT NULL,
FPAYORGID BIGINT DEFAULT 0 NOT NULL,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FDELISUPID BIGINT DEFAULT 0 NOT NULL,
FINVOICESUPID BIGINT DEFAULT 0 NOT NULL,
FPAYEESUPID BIGINT DEFAULT 0 NOT NULL,
FPERSONID BIGINT DEFAULT 0 NOT NULL,
FCONTACTERID BIGINT DEFAULT 0 NOT NULL,
FPAYCONDID BIGINT DEFAULT 0 NOT NULL,
FSETTLETYPEID BIGINT DEFAULT 0 NOT NULL,
FCURRID BIGINT DEFAULT 0 NOT NULL,
FLOCCURRID BIGINT DEFAULT 0 NOT NULL,
FEXCHTYPEID BIGINT DEFAULT 0 NOT NULL,
FEXCHRATE DECIMAL(19,6) DEFAULT 1 NOT NULL,
FTAXTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FSUMAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FBILLSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCFMSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FBIZPARTNERID BIGINT DEFAULT 0 NOT NULL,
FPLATFORM CHAR(1) DEFAULT ' ' NOT NULL,
FPURORDERNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FMALORDERNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPICKWARETYPE CHAR(10) DEFAULT ' ' NOT NULL,
FLINKMAN NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPHONE NVARCHAR(80) DEFAULT ' ' NOT NULL,
FEMAIL NVARCHAR(80) DEFAULT ' ' NOT NULL,
FADDRESS NVARCHAR(80) DEFAULT ' ' NOT NULL,
FRCVORGID BIGINT DEFAULT 0 NOT NULL,
FADMINDIVISION VARCHAR(50) DEFAULT ' ' NOT NULL,
FCARDNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBANK NVARCHAR(80) DEFAULT ' ' NOT NULL,
FCARDUSERNAME NVARCHAR(80) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(512) DEFAULT ' ' NOT NULL,
FSUPADDR NVARCHAR(255) DEFAULT ' ' NOT NULL,
FLASTUPDATEUSERID BIGINT DEFAULT 0 NOT NULL,
FLASTUPDATETIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_CHECKRELATION') 
 CREATE TABLE T_PUR_CHECKRELATION (
FID BIGINT DEFAULT 0 NOT NULL,
FPOENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCENTITYKEY VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FTARENTITYKEY VARCHAR(50) DEFAULT ' ' NOT NULL,
FTARID VARCHAR(50) DEFAULT ' ' NOT NULL,
FTARENTRYID BIGINT DEFAULT 0 NOT NULL,
FQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FCREATEDATE DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_INSTOCK') 
 CREATE TABLE T_PUR_INSTOCK (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FBUSINESSTYPEID BIGINT DEFAULT 0 NOT NULL,
FBIZTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FBILLDATE DATETIME,
FREQORGID BIGINT DEFAULT 0 NOT NULL,
FPURORGID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FSETTLEORGID BIGINT DEFAULT 0 NOT NULL,
FPAYORGID BIGINT DEFAULT 0 NOT NULL,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FDELISUPID BIGINT DEFAULT 0 NOT NULL,
FINVOICESUPID BIGINT DEFAULT 0 NOT NULL,
FPAYEESUPID BIGINT DEFAULT 0 NOT NULL,
FPERSONID BIGINT DEFAULT 0 NOT NULL,
FCONTACTERID BIGINT DEFAULT 0 NOT NULL,
FPAYCONDID BIGINT DEFAULT 0 NOT NULL,
FSETTLETYPEID BIGINT DEFAULT 0 NOT NULL,
FCURRID BIGINT DEFAULT 0 NOT NULL,
FLOCCURRID BIGINT DEFAULT 0 NOT NULL,
FEXCHTYPEID BIGINT DEFAULT 0 NOT NULL,
FEXCHRATE DECIMAL(19,6) DEFAULT 1 NOT NULL,
FTAXTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FSUMAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FBILLSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCFMSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FBIZPARTNERID BIGINT DEFAULT 0 NOT NULL,
FREMARK NVARCHAR(512) DEFAULT ' ' NOT NULL,
FWRITEOFFFLAG CHAR(1) DEFAULT '0' NOT NULL,
FLASTUPDATEUSERID BIGINT DEFAULT 0 NOT NULL,
FLASTUPDATETIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_INVOICE') 
 CREATE TABLE T_PUR_INVOICE (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FBIZTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FBILLDATE DATETIME,
FREQORGID BIGINT DEFAULT 0 NOT NULL,
FPURORGID BIGINT DEFAULT 0 NOT NULL,
FRCVORGID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FPAYORGID BIGINT DEFAULT 0 NOT NULL,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FDELISUPID BIGINT DEFAULT 0 NOT NULL,
FINVOICESUPID BIGINT DEFAULT 0 NOT NULL,
FPAYEESUPID BIGINT DEFAULT 0 NOT NULL,
FPERSONID BIGINT DEFAULT 0 NOT NULL,
FCONTACTERID BIGINT DEFAULT 0 NOT NULL,
FPAYCONDID BIGINT DEFAULT 0 NOT NULL,
FSETTLETYPEID BIGINT DEFAULT 0 NOT NULL,
FCURRID BIGINT DEFAULT 0 NOT NULL,
FLOCCURRID BIGINT DEFAULT 0 NOT NULL,
FEXCHTYPEID BIGINT DEFAULT 0 NOT NULL,
FEXCHRATE DECIMAL(19,6) DEFAULT 1 NOT NULL,
FTAXTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FSUMAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FBILLSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCFMSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FBIZPARTNERID BIGINT DEFAULT 0 NOT NULL,
FREMARK NVARCHAR(512) DEFAULT ' ' NOT NULL,
FWRITEOFFFLAG CHAR(1) DEFAULT '0' NOT NULL,
FLASTUPDATEUSERID BIGINT DEFAULT 0 NOT NULL,
FLASTUPDATETIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_RETURN') 
 CREATE TABLE T_PUR_RETURN (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FBUSINESSTYPEID BIGINT DEFAULT 0 NOT NULL,
FBIZTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FBILLDATE DATETIME,
FRETTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FREPLENISHTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FREQORGID BIGINT DEFAULT 0 NOT NULL,
FPURORGID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FSETTLEORGID BIGINT DEFAULT 0 NOT NULL,
FPAYORGID BIGINT DEFAULT 0 NOT NULL,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FDELISUPID BIGINT DEFAULT 0 NOT NULL,
FINVOICESUPID BIGINT DEFAULT 0 NOT NULL,
FPAYEESUPID BIGINT DEFAULT 0 NOT NULL,
FPERSONID BIGINT DEFAULT 0 NOT NULL,
FCONTACTERID BIGINT DEFAULT 0 NOT NULL,
FPAYCONDID BIGINT DEFAULT 0 NOT NULL,
FSETTLETYPEID BIGINT DEFAULT 0 NOT NULL,
FCURRID BIGINT DEFAULT 0 NOT NULL,
FLOCCURRID BIGINT DEFAULT 0 NOT NULL,
FEXCHTYPEID BIGINT DEFAULT 0 NOT NULL,
FEXCHRATE DECIMAL(19,6) DEFAULT 1 NOT NULL,
FTAXTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FSUMAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FBILLSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCFMSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FBIZPARTNERID BIGINT DEFAULT 0 NOT NULL,
FREMARK NVARCHAR(512) DEFAULT ' ' NOT NULL,
FSUPADDR NVARCHAR(255) DEFAULT ' ' NOT NULL,
FWRITEOFFFLAG CHAR(1) DEFAULT '0' NOT NULL,
FLASTUPDATEUSERID BIGINT DEFAULT 0 NOT NULL,
FLASTUPDATETIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_RECEIPT') 
 CREATE TABLE T_PUR_RECEIPT (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FBUSINESSTYPEID BIGINT DEFAULT 0 NOT NULL,
FBIZTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FBILLDATE DATETIME,
FREQPERSONID BIGINT DEFAULT 0 NOT NULL,
FPURDEPTID BIGINT DEFAULT 0 NOT NULL,
FREQORGID BIGINT DEFAULT 0 NOT NULL,
FPURORGID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FSETTLEORGID BIGINT DEFAULT 0 NOT NULL,
FPAYORGID BIGINT DEFAULT 0 NOT NULL,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FDELISUPID BIGINT DEFAULT 0 NOT NULL,
FINVOICESUPID BIGINT DEFAULT 0 NOT NULL,
FPAYEESUPID BIGINT DEFAULT 0 NOT NULL,
FPERSONID BIGINT DEFAULT 0 NOT NULL,
FCONTACTERID BIGINT DEFAULT 0 NOT NULL,
FPAYCONDID BIGINT DEFAULT 0 NOT NULL,
FSETTLETYPEID BIGINT DEFAULT 0 NOT NULL,
FCURRID BIGINT DEFAULT 0 NOT NULL,
FLOCCURRID BIGINT DEFAULT 0 NOT NULL,
FEXCHTYPEID BIGINT DEFAULT 0 NOT NULL,
FEXCHRATE DECIMAL(19,6) DEFAULT 1 NOT NULL,
FTAXTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FSUMAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FBILLSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCFMSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FBIZPARTNERID BIGINT DEFAULT 0 NOT NULL,
FREPLENISHTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(512) DEFAULT ' ' NOT NULL,
FWRITEOFFFLAG CHAR(1) DEFAULT '0' NOT NULL,
FLASTUPDATEUSERID BIGINT DEFAULT 0 NOT NULL,
FLASTUPDATETIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_INVOICENTRY2') 
 CREATE TABLE T_PUR_INVOICENTRY2 (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FLINETYPEID BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FMATERIALNAMETEXT NVARCHAR(255) DEFAULT ' ' NOT NULL,
FMATERIALDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FASSTPROID VARCHAR(50) DEFAULT ' ' NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDCTRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FDCTAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FISPRESENT CHAR(1) DEFAULT ' ' NOT NULL,
FDEDUCTIONTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FDEDUCTIONDATE DATETIME,
FTAXCODE VARCHAR(50) DEFAULT ' ' NOT NULL,
FISTAXPREF CHAR(1) DEFAULT ' ' NOT NULL,
FTAXPREFPOLICY NVARCHAR(255) DEFAULT ' ' NOT NULL,
FINBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FINBILLDATE DATETIME,
FCOSTID BIGINT DEFAULT 0 NOT NULL,
FNOTE NVARCHAR(512) DEFAULT ' ' NOT NULL,
FENTRYSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FPOBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPCBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPROJECTID BIGINT DEFAULT 0 NOT NULL,
FTRACEID BIGINT DEFAULT 0 NOT NULL,
FREQORGID BIGINT DEFAULT 0 NOT NULL,
FPURORGID BIGINT DEFAULT 0 NOT NULL,
FRCVORGID BIGINT DEFAULT 0 NOT NULL,
FSETTLEORGID BIGINT DEFAULT 0 NOT NULL,
FPAYORGID BIGINT DEFAULT 0 NOT NULL,
FTAXRATEID BIGINT DEFAULT 0 NOT NULL,
FACTCHECKTAXAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FACTCHECKTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FWRITEOFFFLAG CHAR(1) DEFAULT '0' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_CHECK') 
 CREATE TABLE T_PUR_CHECK (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FBIZTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FBILLDATE DATETIME,
FREQORGID BIGINT DEFAULT 0 NOT NULL,
FPURORGID BIGINT DEFAULT 0 NOT NULL,
FRCVORGID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FPAYORGID BIGINT DEFAULT 0 NOT NULL,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FDELISUPID BIGINT DEFAULT 0 NOT NULL,
FINVOICESUPID BIGINT DEFAULT 0 NOT NULL,
FPAYEESUPID BIGINT DEFAULT 0 NOT NULL,
FPERSONID BIGINT DEFAULT 0 NOT NULL,
FCONTACTERID BIGINT DEFAULT 0 NOT NULL,
FPAYCONDID BIGINT DEFAULT 0 NOT NULL,
FSETTLETYPEID BIGINT DEFAULT 0 NOT NULL,
FCURRID BIGINT DEFAULT 0 NOT NULL,
FLOCCURRID BIGINT DEFAULT 0 NOT NULL,
FEXCHTYPEID BIGINT DEFAULT 0 NOT NULL,
FEXCHRATE DECIMAL(19,6) DEFAULT 1 NOT NULL,
FTAXTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FSUMAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMAMOUNT_IN DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMDIFFQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMDIFFAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FBILLSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCFMSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FBIZPARTNERID BIGINT DEFAULT 0 NOT NULL,
FSUPGROUPID BIGINT DEFAULT 0 NOT NULL,
FREMARK NVARCHAR(512) DEFAULT ' ' NOT NULL,
FINVSTATUS CHAR(1) DEFAULT 'A' NOT NULL,
FLASTUPDATEUSERID BIGINT DEFAULT 0 NOT NULL,
FLASTUPDATETIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_ORDER_A') 
 CREATE TABLE T_PUR_ORDER_A (
FID 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,
FAUDITDATE DATETIME,
FCFMID BIGINT DEFAULT 0 NOT NULL,
FCFMDATE DATETIME,
FSUGGESTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FORIGIN CHAR(1) DEFAULT ' ' NOT NULL,
FBILLVERSION NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FJDORDERID NVARCHAR(80) DEFAULT ' ' NOT NULL,
FSUMSETTLEAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMSALOUTAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMDIFFAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FCHECKSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCLOSESTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCLOSEID BIGINT DEFAULT 0 NOT NULL,
FCLOSEDATE DATETIME,
FREASON NVARCHAR(255) DEFAULT ' ' NOT NULL,
FASYNCSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(512) DEFAULT ' ' NOT NULL,
FREJECTRESON NVARCHAR(512) DEFAULT '0' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_CHECK_A') 
 CREATE TABLE T_PUR_CHECK_A (
FID 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,
FAUDITDATE DATETIME,
FCFMID BIGINT DEFAULT 0 NOT NULL,
FCFMDATE DATETIME,
FSUGGESTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FCHECKSOURCE CHAR(1) DEFAULT ' ' NOT NULL,
FORIGIN CHAR(1) DEFAULT ' ' NOT NULL,
FINVTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FINVDETAIL CHAR(1) DEFAULT ' ' NOT NULL,
FCHKSCHEMEID BIGINT DEFAULT 0 NOT NULL,
FDATEFROM DATETIME,
FDATETO DATETIME,
FISPAYREQUEST CHAR(1) DEFAULT ' ' NOT NULL,
FINVTYPEID BIGINT DEFAULT 0 NOT NULL,
FPAYREQBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(512) DEFAULT ' ' NOT NULL,
FREJECTRESON NVARCHAR(512) DEFAULT '0' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_INVOICE_A') 
 CREATE TABLE T_PUR_INVOICE_A (
FID 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,
FAUDITDATE DATETIME,
FCFMID BIGINT DEFAULT 0 NOT NULL,
FCFMDATE DATETIME,
FSUGGESTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FORIGIN CHAR(1) DEFAULT ' ' NOT NULL,
FINVTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FINVDETAIL CHAR(1) DEFAULT ' ' NOT NULL,
FINVOICECODE VARCHAR(255) DEFAULT ' ' NOT NULL,
FINVOICENO VARCHAR(255) DEFAULT ' ' NOT NULL,
FINVOICEDATE DATETIME,
FINVOICEID VARCHAR(50) DEFAULT ' ' NOT NULL,
FITEMNAME VARCHAR(255) DEFAULT ' ' NOT NULL,
FTAXCODE VARCHAR(50) DEFAULT ' ' NOT NULL,
FTAXRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FINVADDRESS VARCHAR(1000) DEFAULT ' ' NOT NULL,
FSERIALNUM VARCHAR(50) DEFAULT ' ' NOT NULL,
FPAYABLENO VARCHAR(80) DEFAULT ' ' NOT NULL,
FPAYABLEAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FCFMNOTE VARCHAR(255) DEFAULT ' ' NOT NULL,
FCHECKBILLNO VARCHAR(80) DEFAULT ' ' NOT NULL,
FREQPERSONID BIGINT DEFAULT 0 NOT NULL,
FREVPHONE NVARCHAR(255) DEFAULT ' ' NOT NULL,
FREVADDRESS NVARCHAR(255) DEFAULT ' ' NOT NULL,
FREVNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FISPAY CHAR(1) DEFAULT ' ' NOT NULL,
FJDORDER BIGINT DEFAULT 0 NOT NULL,
FINVTYPEID BIGINT DEFAULT 0 NOT NULL,
FREMARK NVARCHAR(512) DEFAULT ' ' NOT NULL,
FREJECTRESON NVARCHAR(512) DEFAULT '0' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_INSTOCKENTRY_A') 
 CREATE TABLE T_PUR_INSTOCKENTRY_A (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FGOODSID BIGINT DEFAULT 0 NOT NULL,
FGOODSDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FBASICUNITID BIGINT DEFAULT 0 NOT NULL,
FBASICQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSTUNITID BIGINT DEFAULT 0 NOT NULL,
FASSTQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FACTPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FACTTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPOBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPOENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCINSBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCINSENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSUMCHECKQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMCHECKAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSETTLESUPID BIGINT DEFAULT 0 NOT NULL,
FUNMATCHBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FISCHECKORINVOICE CHAR(1) DEFAULT '0' NOT NULL,
FMATCHQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FUNMATCHQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMATCHAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FUNMATCHAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPURTYPEID BIGINT DEFAULT 0 NOT NULL,
FSUMINVOICEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUMINVOICEAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FINVOICEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FINVOICEAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSALOUTID BIGINT DEFAULT 0 NOT NULL,
FSALOUTENTRYID BIGINT DEFAULT 0 NOT NULL,
FSALOUTNUM NVARCHAR(80) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_RECEIPTENTRY_A') 
 CREATE TABLE T_PUR_RECEIPTENTRY_A (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FGOODSID BIGINT DEFAULT 0 NOT NULL,
FGOODSDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FBASICUNITID BIGINT DEFAULT 0 NOT NULL,
FBASICQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSTUNITID BIGINT DEFAULT 0 NOT NULL,
FASSTQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FACTPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FACTTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPOBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPOENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSUMCHECKQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMCHECKAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPURTYPEID BIGINT DEFAULT 0 NOT NULL,
FSETTLESUPID BIGINT DEFAULT 0 NOT NULL,
FINVOICEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FINVOICEAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FISCHECKORINVOICE CHAR(1) DEFAULT '0' NOT NULL,
FUNMATCHBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FUNMATCHQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUMINVOICEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSALOUTID BIGINT DEFAULT 0 NOT NULL,
FSALOUTENTRYID BIGINT DEFAULT 0 NOT NULL,
FSALOUTNUM NVARCHAR(80) DEFAULT ' ' NOT NULL,
FSUMRECRETQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUMRECRETBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_RETURNENTRY_A') 
 CREATE TABLE T_PUR_RETURNENTRY_A (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FGOODSID BIGINT DEFAULT 0 NOT NULL,
FGOODSDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FBASICUNITID BIGINT DEFAULT 0 NOT NULL,
FBASICQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSTUNITID BIGINT DEFAULT 0 NOT NULL,
FASSTQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FACTPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FACTTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPOBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPOENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCINSBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCINSENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSUMRETURNQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMCHECKQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMCHECKAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSETTLESUPID BIGINT DEFAULT 0 NOT NULL,
FMATCHQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FISCHECKORINVOICE CHAR(1) DEFAULT '0' NOT NULL,
FUNMATCHQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FUNMATCHBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMATCHAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FUNMATCHAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPURTYPEID BIGINT DEFAULT 0 NOT NULL,
FINVOICEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FINVOICEAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUMINVOICEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSALOUTID BIGINT DEFAULT 0 NOT NULL,
FSALOUTENTRYID BIGINT DEFAULT 0 NOT NULL,
FSALOUTNUM NVARCHAR(80) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_CHECKENTRY2') 
 CREATE TABLE T_PUR_CHECKENTRY2 (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FLINETYPEID BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FMATERIALNAMETEXT NVARCHAR(255) DEFAULT ' ' NOT NULL,
FMATERIALDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FASSTPROID VARCHAR(50) DEFAULT ' ' NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FINQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FOUTQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FDIFFQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FUNMATCHAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FUNMATCHQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FINTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FOUTTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FDIFFAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDCTRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FDCTAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FISPRESENT CHAR(1) DEFAULT ' ' NOT NULL,
FINBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FINBILLDATE DATETIME,
FOUTBILLNO NVARCHAR(255) DEFAULT ' ' NOT NULL,
FNOTE NVARCHAR(512) DEFAULT ' ' NOT NULL,
FENTRYSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FPOBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPCBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPROJECTID BIGINT DEFAULT 0 NOT NULL,
FTRACEID BIGINT DEFAULT 0 NOT NULL,
FREQORGID BIGINT DEFAULT 0 NOT NULL,
FPURORGID BIGINT DEFAULT 0 NOT NULL,
FRCVORGID BIGINT DEFAULT 0 NOT NULL,
FSETTLEORGID BIGINT DEFAULT 0 NOT NULL,
FPAYORGID BIGINT DEFAULT 0 NOT NULL,
FTAXRATEID BIGINT DEFAULT 0 NOT NULL,
FACTCHECKTAXAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FACTCHECKTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FWRITEOFFFLAG CHAR(1) DEFAULT '0' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_ORDERENTRY_A') 
 CREATE TABLE T_PUR_ORDERENTRY_A (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FGOODSID BIGINT DEFAULT 0 NOT NULL,
FGOODSDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FBASICUNITID BIGINT DEFAULT 0 NOT NULL,
FBASICQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSTUNITID BIGINT DEFAULT 0 NOT NULL,
FASSTQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCTAX DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCTAXAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FACTPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FACTTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPOBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPOENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FRCVPERSONID BIGINT DEFAULT 0 NOT NULL,
FRCVPERSONTEL VARCHAR(50) DEFAULT ' ' NOT NULL,
FSUMRECEIVEQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMOUTSTOCKQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMRECEIPTQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMINSTOCKQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMRETURNREQQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMRETURNQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMRECRETQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSUMINSTOCKRETQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FVMISTOCKQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPAYABLEQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPAYABLEAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FINVOICEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FINVOICEAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPREPAYAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPAYPREPAYAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPAYAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FLOCKPREPAYAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPURTYPEID BIGINT DEFAULT 0 NOT NULL,
FCOSTITEMID BIGINT DEFAULT 0 NOT NULL,
FJDORDER BIGINT DEFAULT 0 NOT NULL,
FERPSOURCEENTRYID NVARCHAR(255) DEFAULT ' ' NOT NULL,
FERPSOURCEID NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSUMREJQTY DECIMAL(19,6) DEFAULT 0 NOT NULL,
FROWCLOSEID BIGINT DEFAULT 0 NOT NULL,
FROWCLOSEREASON NVARCHAR(255) DEFAULT ' ' NOT NULL,
FROWCLOSEDATE DATETIME,
FRELATEOUTSTOCKQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FRELATEOUTSTOCKBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUMREFUNDQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUMREFUNDBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUMOUTSTOCKBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FISCONTROLQTY CHAR(1) DEFAULT '1' NOT NULL,
FSALOUTRATEDOWN DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSALOUTRATEUP DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSALOUTQTYDOWN DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSALOUTBASEQTYDOWN DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSALOUTQTYUP DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSALOUTBASEQTYUP DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUMRECEIPTBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUMINSTOCKBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUMRECRETBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUMINSTOCKRETBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_CALFORMULAENTITY') 
 CREATE TABLE T_PUR_CALFORMULAENTITY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FMETADATAID VARCHAR(50) DEFAULT ' ' NOT NULL,
FCHILDFORMULA NVARCHAR(500) DEFAULT ' ' NOT NULL,
FCHILDFORMULATRAN NVARCHAR(1000) DEFAULT ' ' NOT NULL,
FBEFOREFILTER NVARCHAR(500) DEFAULT ' ' NOT NULL,
FBEFOREFILTERTRAN NVARCHAR(1000) DEFAULT ' ' NOT NULL,
FAFTERFILTER NVARCHAR(500) DEFAULT ' ' NOT NULL,
FAFTERFILTERTRAN NVARCHAR(1000) DEFAULT ' ' NOT NULL,
FORGFIELD VARCHAR(50) DEFAULT ' ' NOT NULL,
FSUPPLIERFIELD VARCHAR(50) DEFAULT ' ' NOT NULL,
FMATERIALFIELD VARCHAR(50) DEFAULT ' ' NOT NULL,
FEVALPERIODFIELD VARCHAR(50) DEFAULT ' ' NOT NULL,
FGROUPBY NVARCHAR(255) DEFAULT ' ' NOT NULL,
FENTITYCODE VARCHAR(50) DEFAULT ' ' NOT NULL,
FEVADIMENSIONFILTER CHAR(1) DEFAULT 'A' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_SCDATASERVICE') 
 CREATE TABLE T_PUR_SCDATASERVICE (
FID VARCHAR(36) DEFAULT ' ' NOT NULL,
FNUMBER VARCHAR(80) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FENABLE CHAR(1) DEFAULT '1' NOT NULL,
FENTITYID VARCHAR(36) DEFAULT ' ' NOT NULL,
FISV VARCHAR(255) DEFAULT ' ' NOT NULL,
FHANDLEPROPERTY VARCHAR(120) DEFAULT ' ' NOT NULL,
FSERVICETYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FSERVICECLASS VARCHAR(255) DEFAULT ' ' NOT NULL,
FMASTERID VARCHAR(36) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_SCDATACONFIG') 
 CREATE TABLE T_PUR_SCDATACONFIG (
FID VARCHAR(36) DEFAULT ' ' NOT NULL,
FNUMBER VARCHAR(80) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FENABLE CHAR(1) DEFAULT '1' NOT NULL,
FSERVICETYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FSTORECLASS VARCHAR(255) DEFAULT ' ' NOT NULL,
FSCDATACHANNELID VARCHAR(36) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME
);



/**End C:\PDM_UPGRADE\PDM1\PUR_table.sql **/
