/**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_SALOUTWFRECORDENTRY_E') 
 CREATE TABLE T_AR_SALOUTWFRECORDENTRY_E (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FVERIFYLOCAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FVERIFYLOCPRICETOTAL DECIMAL(23,10) DEFAULT 0 NOT NULL,
FVERIFYLOCTAX DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSVERIFYLOCAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSVERIFYLOCPRICETOTAL DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSVERIFYLOCTAX DECIMAL(23,10) DEFAULT 0 NOT NULL,
FQUOTATION VARCHAR(30) DEFAULT '0' NOT NULL,
FASSQUOTATION VARCHAR(30) DEFAULT '0' NOT NULL,
FEXCHANGERATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSEXCHANGERATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBOOKDATE DATETIME,
FASSBOOKDATE DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AR_REV_VRRECORDENTRY_E' AND KSQL_COL_NAME ='FASSBOOKDATE') 
 ALTER TABLE T_AR_REV_VRRECORDENTRY_E ADD (FASSBOOKDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AR_REV_VRRECORDENTRY_E' AND KSQL_COL_NAME ='FBOOKDATE') 
 ALTER TABLE T_AR_REV_VRRECORDENTRY_E ADD (FBOOKDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AR_REV_VRRECORDENTRY_E' AND KSQL_COL_NAME ='FACTUNITPRICE')
 ALTER TABLE T_AR_REV_VRRECORDENTRY_E ADD (FACTUNITPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AR_REV_VRRECORDENTRY_E' AND KSQL_COL_NAME ='FASSACTUNITPRICE')
 ALTER TABLE T_AR_REV_VRRECORDENTRY_E ADD (FASSACTUNITPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AR_ORIGINALWFENTRY' AND KSQL_COL_NAME ='FBOOKDATE')
 ALTER TABLE T_AR_ORIGINALWFENTRY ADD (FBOOKDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AR_ORIGINALWFENTRY' AND KSQL_COL_NAME ='FASSBILLSOURCETYPE')
 ALTER TABLE T_AR_ORIGINALWFENTRY ADD (FASSBILLSOURCETYPE VARCHAR(30) DEFAULT ' ' NOT NULL );

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