/**Begin C:\PDM_UPGRADE\PDM1\PUR_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_ORDERENTRY_O') 
 CREATE TABLE T_PUR_ORDERENTRY_O (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FMFTORDERNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FTECHNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FOPROPERATION NVARCHAR(80) DEFAULT ' ' NOT NULL,
FOPROPERATIONNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FOPRDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FOPRENTRYSEQ VARCHAR(20) DEFAULT ' ' NOT NULL,
FMFTORDERENTRYSEQ VARCHAR(20) DEFAULT ' ' NOT NULL,
FPROCESSSEQ VARCHAR(50) DEFAULT ' ' NOT NULL,
FMFTORDERID VARCHAR(50) DEFAULT ' ' NOT NULL,
FMFTORDERENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FTECHID VARCHAR(50) DEFAULT ' ' NOT NULL,
FOPRENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FOPROPERATIONID VARCHAR(50) DEFAULT ' ' NOT NULL,
FCONFIGUREDCODEID BIGINT DEFAULT 0 NOT NULL,
FMFTSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FMFTDIRECT CHAR(1) DEFAULT '0' NOT NULL,
FPRODUCTTYPE CHAR(1) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_XORDER') 
 CREATE TABLE T_PUR_XORDER (
FID BIGINT DEFAULT 0 NOT NULL,
FCHANGEBIZDATE DATETIME,
FCHANGEBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FSOURCEBILLID BIGINT DEFAULT 0 NOT NULL,
FSOURCEBILLENTITY NVARCHAR(80) DEFAULT ' ' 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(23,10) DEFAULT 1 NOT NULL,
FTAXTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FSUMAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUMTAX DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUMTAXAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUMQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCENTERSETTLE CHAR(1) DEFAULT '0' NOT NULL,
FPREPAYRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUMPREPAYAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUMPAYABLEAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUMINVOICEAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUMPAYAMT DECIMAL(23,10) 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 '0' NOT NULL,
FREMARK NVARCHAR(512) DEFAULT ' ' NOT NULL,
FLASTUPDATEUSERID BIGINT DEFAULT 0 NOT NULL,
FLASTUPDATETIME DATETIME,
FCHANGEREASON NVARCHAR(512) DEFAULT ' ' NOT NULL,
FVALIDSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FVALIDER BIGINT DEFAULT 0 NOT NULL,
FVALIDDATE DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_XORDER_A') 
 CREATE TABLE T_PUR_XORDER_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(23,10) DEFAULT 0 NOT NULL,
FSUMSALOUTAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUMDIFFAMOUNT DECIMAL(23,10) 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,
FREJECTREASON NVARCHAR(512) DEFAULT '0' NOT NULL,
FREJECTERID BIGINT DEFAULT 0 NOT NULL,
FREJECTDATE DATETIME,
FCHANGESTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCHANGERID BIGINT DEFAULT 0 NOT NULL,
FCHANGEDATE DATETIME,
FSUBVERSION NVARCHAR(50) DEFAULT ' ' NOT NULL,
FVERSION NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_XORDER_L') 
 CREATE TABLE T_PUR_XORDER_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,
FCHANGEREASON NVARCHAR(512) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_XORDERENTRY') 
 CREATE TABLE T_PUR_XORDERENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT 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(23,10) DEFAULT 0 NOT NULL,
FPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDISCOUNTTYPE VARCHAR(5) DEFAULT 'NULL' NOT NULL,
FTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDCTRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDCTAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAX DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FISPRESENT CHAR(1) DEFAULT '0' 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,
FSCHEDULEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSCHEDULEBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPAYENTRYCHANGETYPE CHAR(1) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_XORDERENTRY_A') 
 CREATE TABLE T_PUR_XORDERENTRY_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(23,10) DEFAULT 0 NOT NULL,
FLOCAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FLOCTAX DECIMAL(23,10) DEFAULT 0 NOT NULL,
FLOCTAXAMOUNT DECIMAL(23,10) 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,
FRCVPERSONNAME NVARCHAR(200) DEFAULT ' ' NOT NULL,
FRCVPERSONTEL VARCHAR(50) DEFAULT ' ' NOT NULL,
FSUMRECEIVEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUMOUTSTOCKQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUMRECEIPTQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUMINSTOCKQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUMRETURNREQQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUMRETURNQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUMRECRETQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUMINSTOCKRETQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FVMISTOCKQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPAYABLEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPAYABLEAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FINVOICEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FINVOICEAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPREPAYAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPAYPREPAYAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPAYAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FLOCKPREPAYAMT DECIMAL(23,10) 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(23,10) 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,
FISCONTROLAMOUNTUP CHAR(1) DEFAULT '0' NOT NULL,
FAMOUNTUP DECIMAL(23,10) DEFAULT 0 NOT NULL,
FRELATEAPACCEPTTAXAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUMAPACCEPTTAXAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUMACCEPTTAXAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_XORDERENTRY_O') 
 CREATE TABLE T_PUR_XORDERENTRY_O (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FMFTORDERNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FTECHNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FOPROPERATION NVARCHAR(80) DEFAULT ' ' NOT NULL,
FOPROPERATIONNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FOPRDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FOPRENTRYSEQ VARCHAR(20) DEFAULT ' ' NOT NULL,
FMFTORDERENTRYSEQ VARCHAR(20) DEFAULT ' ' NOT NULL,
FPROCESSSEQ VARCHAR(50) DEFAULT ' ' NOT NULL,
FMFTORDERID VARCHAR(50) DEFAULT ' ' NOT NULL,
FMFTORDERENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FTECHID VARCHAR(50) DEFAULT ' ' NOT NULL,
FOPRENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FOPROPERATIONID VARCHAR(50) DEFAULT ' ' NOT NULL,
FCONFIGUREDCODEID BIGINT DEFAULT 0 NOT NULL,
FMFTSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FMFTDIRECT CHAR(1) DEFAULT '0' NOT NULL,
FPRODUCTTYPE CHAR(1) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_SALOUTSTOCKENTRY_O') 
 CREATE TABLE T_PUR_SALOUTSTOCKENTRY_O (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FMFTORDERNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FTECHNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FOPROPERATION NVARCHAR(80) DEFAULT ' ' NOT NULL,
FOPROPERATIONNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FOPRDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FOPRENTRYSEQ VARCHAR(20) DEFAULT ' ' NOT NULL,
FMFTORDERENTRYSEQ VARCHAR(20) DEFAULT ' ' NOT NULL,
FPROCESSSEQ VARCHAR(50) DEFAULT ' ' NOT NULL,
FMFTORDERID VARCHAR(50) DEFAULT ' ' NOT NULL,
FMFTORDERENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FTECHID VARCHAR(50) DEFAULT ' ' NOT NULL,
FOPRENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FOPROPERATIONID VARCHAR(50) DEFAULT ' ' NOT NULL,
FCONFIGUREDCODEID BIGINT DEFAULT 0 NOT NULL,
FMFTSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FMFTDIRECT CHAR(1) DEFAULT '0' NOT NULL,
FPRODUCTTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FPAYENTRYCHANGETYPE CHAR(1) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_INSTOCKENTRY_O') 
 CREATE TABLE T_PUR_INSTOCKENTRY_O (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FMFTORDERNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FTECHNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FOPROPERATION NVARCHAR(80) DEFAULT ' ' NOT NULL,
FOPROPERATIONNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FOPRDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FOPRENTRYSEQ VARCHAR(20) DEFAULT ' ' NOT NULL,
FMFTORDERENTRYSEQ VARCHAR(20) DEFAULT ' ' NOT NULL,
FPROCESSSEQ VARCHAR(50) DEFAULT ' ' NOT NULL,
FMFTORDERID VARCHAR(50) DEFAULT ' ' NOT NULL,
FMFTORDERENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FTECHID VARCHAR(50) DEFAULT ' ' NOT NULL,
FOPRENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FOPROPERATIONID VARCHAR(50) DEFAULT ' ' NOT NULL,
FCONFIGUREDCODEID BIGINT DEFAULT 0 NOT NULL,
FPRODUCTTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FPAYENTRYCHANGETYPE CHAR(1) DEFAULT ' ' NOT NULL
);


/**Begin C:\PDM_UPGRADE\PDM1\PUR_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_XORDER' AND KSQL_COL_NAME IN ('FBASEDATAFIELD'))
ALTER TABLE T_PUR_XORDER ADD (FBASEDATAFIELD BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_XORDERENTRY' AND KSQL_COL_NAME IN ('FSRCBILLENTRYSEQ'))
ALTER TABLE T_PUR_XORDERENTRY ADD (FSRCBILLENTRYSEQ CHAR(20) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_XORDERENTRY' AND KSQL_COL_NAME IN ('FJOINTDATACHANNELID'))
ALTER TABLE T_PUR_XORDERENTRY ADD (FJOINTDATACHANNELID VARCHAR(50) DEFAULT ' ' NOT NULL );

 EXEC p_AlterColumn 'T_PUR_ORDERENTRY_O', 'FPROCESSSEQ', 'VARCHAR(50)', 'NOT NULL', '0100', ''' ''';

 EXEC p_AlterColumn 'T_PUR_XORDERENTRY_O', 'FPROCESSSEQ', 'VARCHAR(50)', 'NOT NULL', '0100', ''' ''';

 EXEC p_AlterColumn 'T_PUR_SALOUTSTOCKENTRY_O', 'FPROCESSSEQ', 'VARCHAR(50)', 'NOT NULL', '0100', ''' ''';

 EXEC p_AlterColumn 'T_PUR_INSTOCKENTRY_O', 'FPROCESSSEQ', 'VARCHAR(50)', 'NOT NULL', '0100', ''' ''';
