/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\AR_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_AR_SALOUTWFRECORD') 
 CREATE TABLE T_AR_SALOUTWFRECORD (
FID BIGINT DEFAULT 0 NOT NULL,
FWFNUMBER VARCHAR(30) DEFAULT ' ' NOT NULL,
FWFSEQ VARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FWRITEOFFTYPEID BIGINT DEFAULT 0 NOT NULL,
FWFSCHEMEID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FASSTACTTYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FASSTACTID BIGINT DEFAULT 0 NOT NULL,
FISVOUCHER CHAR(1) DEFAULT '0' NOT NULL,
FVOUCHERNUM NVARCHAR(80) DEFAULT ' ' NOT NULL,
FCREATEDATE DATETIME,
FHEADWFINFO NVARCHAR(255) DEFAULT ' ' NOT NULL,
FHEADWFINFO_TAG NCLOB,
FBILLSTATUS VARCHAR(30) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_AR_ORIGINALWFRECORD') 
 CREATE TABLE T_AR_ORIGINALWFRECORD (
FID BIGINT DEFAULT 0 NOT NULL,
FWFNUMBER VARCHAR(30) DEFAULT ' ' NOT NULL,
FWFSEQ VARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FWRITEOFFTYPEID BIGINT DEFAULT 0 NOT NULL,
FWFSCHEMEID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FASSTACTTYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FASSTACTID BIGINT DEFAULT 0 NOT NULL,
FISVOUCHER CHAR(1) DEFAULT '0' NOT NULL,
FVOUCHERNUM NVARCHAR(80) DEFAULT ' ' NOT NULL,
FCREATEDATE DATETIME,
FHEADWFINFO NVARCHAR(255) DEFAULT ' ' NOT NULL,
FHEADWFINFO_TAG NCLOB,
FBILLSTATUS VARCHAR(30) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_AR_ORIGINALWFENTRY') 
 CREATE TABLE T_AR_ORIGINALWFENTRY (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FBILLTYPE VARCHAR(36) DEFAULT ' ' NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FBIZDATE DATETIME,
FPAYPROPERTYID BIGINT DEFAULT 0 NOT NULL,
FCURRENCYID BIGINT DEFAULT 0 NOT NULL,
FBASECURRENCYID BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FEXPENSEITEMID BIGINT DEFAULT 0 NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FBASEUNITID BIGINT DEFAULT 0 NOT NULL,
FBILLQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBILLBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FLOCALAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAX DECIMAL(23,10) DEFAULT 0 NOT NULL,
FLOCTAX DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPRICETAXTOTAL DECIMAL(23,10) DEFAULT 0 NOT NULL,
FLOCPRICETAXTOTAL DECIMAL(23,10) DEFAULT 0 NOT NULL,
FVERIFYVALUE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FVERIFYLOCAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FVERIFYAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FVERIFYQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCOREBILLTYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FCOREBILLNO NVARCHAR(255) DEFAULT ' ' NOT NULL,
FCOREBILLENTRYSEQ BIGINT DEFAULT 0 NOT NULL,
FBILLID BIGINT DEFAULT 0 NOT NULL,
FBILLENTRYID BIGINT DEFAULT 0 NOT NULL,
FSRCBILLID BIGINT DEFAULT 0 NOT NULL,
FSRCBILLENTRYID BIGINT DEFAULT 0 NOT NULL,
FMAINWFINFO NVARCHAR(255) DEFAULT ' ' NOT NULL,
FMAINWFINFO_TAG NCLOB,
FASSBILLTYPE VARCHAR(36) DEFAULT ' ' NOT NULL,
FASSBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FASSBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FASSBIZDATE DATETIME,
FASSCURRENCYID BIGINT DEFAULT 0 NOT NULL,
FASSBASECURRENCYID BIGINT DEFAULT 0 NOT NULL,
FASSMATERIALID BIGINT DEFAULT 0 NOT NULL,
FASSEXPENSEITEMID BIGINT DEFAULT 0 NOT NULL,
FASSUNITID BIGINT DEFAULT 0 NOT NULL,
FASSBILLQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSLOCALAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSTAX DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSLOCTAX DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSTAXRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSPRICETAXTOTAL DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSLOCPRICETAXTOTAL DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSVERIFYVALUE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSVERIFYQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSVERIFYAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSVERIFYLOCAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSCOREBILLTYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FASSCOREBILLNO NVARCHAR(255) DEFAULT ' ' NOT NULL,
FASSCOREBILLENTRYSEQ BIGINT DEFAULT 0 NOT NULL,
FASSBILLID BIGINT DEFAULT 0 NOT NULL,
FASSBILLENTRYID BIGINT DEFAULT 0 NOT NULL,
FASSSRCBILLID NVARCHAR(255) DEFAULT ' ' NOT NULL,
FASSSRCBILLENTRYID BIGINT DEFAULT 0 NOT NULL,
FASSINVOICENO VARCHAR(255) DEFAULT ' ' NOT NULL,
FASSINVOICECODE VARCHAR(255) DEFAULT ' ' NOT NULL,
FHADWRITTENOFF CHAR(1) DEFAULT '0' NOT NULL,
FISWRITTENOFF CHAR(1) DEFAULT '0' NOT NULL,
FBACKWFOP NVARCHAR(50) DEFAULT ' ' NOT NULL,
FASSWFINFO NVARCHAR(255) DEFAULT ' ' NOT NULL,
FASSWFINFO_TAG NCLOB
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_AR_SALOUTWFRECORDENTRY') 
 CREATE TABLE T_AR_SALOUTWFRECORDENTRY (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FBILLTYPE VARCHAR(36) DEFAULT ' ' NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FBIZDATE DATETIME,
FPAYPROPERTYID BIGINT DEFAULT 0 NOT NULL,
FCURRENCYID BIGINT DEFAULT 0 NOT NULL,
FBASECURRENCYID BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FEXPENSEITEMID BIGINT DEFAULT 0 NOT NULL,
FUNIT BIGINT DEFAULT 0 NOT NULL,
FBASEUNIT BIGINT DEFAULT 0 NOT NULL,
FBILLQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBILLBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FLOCALAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAX DECIMAL(23,10) DEFAULT 0 NOT NULL,
FLOCTAX DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPRICETAXTOTAL DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPRICETAXTOTALBASE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FVERIFYQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FVERIFYBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FVERIFYAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCOREBILLTYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FCOREBILLNO NVARCHAR(255) DEFAULT ' ' NOT NULL,
FCOREBILLENTRYSEQ BIGINT DEFAULT 0 NOT NULL,
FBILLID BIGINT DEFAULT 0 NOT NULL,
FBILLENTRYID BIGINT DEFAULT 0 NOT NULL,
FSRCBILLID BIGINT DEFAULT 0 NOT NULL,
FSRCBILLENTRYID BIGINT DEFAULT 0 NOT NULL,
FMAINWFINFO NVARCHAR(255) DEFAULT ' ' NOT NULL,
FMAINWFINFO_TAG NCLOB,
FASSBILLTYPE VARCHAR(36) DEFAULT ' ' NOT NULL,
FASSBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FASSBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FASSBIZDATE DATETIME,
FASSCURRENCYID BIGINT DEFAULT 0 NOT NULL,
FASSBASECURRENCYID BIGINT DEFAULT 0 NOT NULL,
FASSMATERIALID BIGINT DEFAULT 0 NOT NULL,
FASSUNITID BIGINT DEFAULT 0 NOT NULL,
FASSBASEUNITID BIGINT DEFAULT 0 NOT NULL,
FASSBILLQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSBILLBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSLOCALAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSTAXRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSTAX DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSLOCTAX DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSPRICETAXTOTAL DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSPRICETAXTOTALBASE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSVERIFYQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSVERIFYBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSVERIFYAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSCOREBILLTYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FASSCOREBILLNO NVARCHAR(255) DEFAULT ' ' NOT NULL,
FASSCOREBILLENTRYSEQ BIGINT DEFAULT 0 NOT NULL,
FASSBILLID BIGINT DEFAULT 0 NOT NULL,
FASSBILLENTRYID BIGINT DEFAULT 0 NOT NULL,
FASSSRCBILLID BIGINT DEFAULT 0 NOT NULL,
FASSSRCBILLENTRYID BIGINT DEFAULT 0 NOT NULL,
FHADWRITTENOFF CHAR(1) DEFAULT '0' NOT NULL,
FISWRITTENOFF CHAR(1) DEFAULT '0' NOT NULL,
FBACKWFOP NVARCHAR(50) DEFAULT ' ' NOT NULL,
FASSWFINFO NVARCHAR(255) DEFAULT ' ' NOT NULL,
FASSWFINFO_TAG NCLOB
);



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